gpt4 book ai didi

javascript - 未捕获( promise ): SecurityError: Failed to execute 'pushState' on 'History'

转载 作者:行者123 更新时间:2023-12-01 19:35:47 24 4
gpt4 key购买 nike

这些是我的路线:

const routes:Routes =[
{path:'', component:WelcomeComponent},
{path:'profile', component: ProfileComponent},
{path:'addcourse', component: AddcourseComponent},
{path:'course', component: CourseComponent},
{path:'editCourse', component: EditCourseComponent},
{path:'addLectures', component: AddLectureComponent},
{path:'login', component:LoginComponent},
{path:'register', component:RegisterComponent},
// { path: 'newform', canActivate:[AuthGuard], component:NewFomComponent},
{ path: '**', redirectTo:'', pathMatch:'full'}

我的应用程序从欢迎页面开始,当我单击登录时,它会将我带到类(class)页面,单击类(class)后,应用程序应该将我带到类(class)组件​​,但它会重定向到欢迎页面,当我单击登录时,它会重定向到欢迎页面给我这个错误:

ERROR Error: Uncaught (in promise): SecurityError: Failed to execute 'pushState' on 'History': A history state object with URL 'http://%28login%29/' cannot be created in a document with origin 'http://localhost:4200' and URL 'http://localhost:4200/'.
Error: Failed to execute 'pushState' on 'History': A history state object with URL 'http://%28login%29/' cannot be created in a document with origin 'http://localhost:4200' and URL 'http://localhost:4200/'.

我查找过类似的问题,所有这些问题都建议检查基本 href,在我的应用程序中它设置为/所以没有问题。谁能请问我做错了什么吗?

最佳答案

尝试在路线上添加斜杠:

<a mat-list-item routerLink="/profile" routerLinkActive>Profile</a>

关于javascript - 未捕获( promise ): SecurityError: Failed to execute 'pushState' on 'History' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47440654/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com