如何在 child 视图中使用 [routerLink] 单击到另一个 child 视图?
How can I clicked with [routerLink] inside a child view to another child view?
我在 Angular 的网站上的视图有一个小问题,因为我正试图从一个 child 的视图转到另一个 child 的视图在我的申请中。当我单击带有 routerlink
的按钮时,它会将我带到视图,但问题是视图变暗,我不能再做,直到我用 f5
或从我的网络导航器重新加载 button
。
路线
const routes: Routes = [
{
path:'',
component: HomeComponent
},
{
path:'login',
component: LoginComponent
},
{
path:'administrator',
component: AdministratorComponent,
canActivate: [AuthGuard],
children:
[
{ path: '', component: DashboardComponent },
{ path: 'contact', component: ContactComponent },
{ path: 'information', component: InformationComponent },
{ path: 'logout', component: LogoutComponent },
{ path: 'letter', component: LetterComponent },
]
},
{ path: 'home', component: HomeComponent },
{ path: 'error', component: ErrorComponent },
{
path: '**',
redirectTo: "/error"
}
];
这是我网页的模型:
并尝试访问我的 children 视图:
<button type="button" class="btn btn-success" [routerLink]="['/administrator/letter']">
Check
</button>
Note: If I access from the AdministratorComponent
it works just like I'm wating for, but in this case I need another way to make it.
怎样才能正确访问那个视图?
我不会删除这个问题,因为这个错误或错误可能会发生在另一个人身上。在这种情况下,我忘记说在视图中我使用的是模态 window,因此模态 window 的 class 用于访问其他辅助视图的 class 保持激活状态(遮盖了正在访问的视图)
就像这样:
好的,请问如何解决?
只需要使用一个属性来关闭模态:data-dismiss
<button type="button" class="btn btn-success" data-dismiss="modal" [routerLink]="['/administrator/letter']">
Check
</button>
我在 Angular 的网站上的视图有一个小问题,因为我正试图从一个 child 的视图转到另一个 child 的视图在我的申请中。当我单击带有 routerlink
的按钮时,它会将我带到视图,但问题是视图变暗,我不能再做,直到我用 f5
或从我的网络导航器重新加载 button
。
路线
const routes: Routes = [
{
path:'',
component: HomeComponent
},
{
path:'login',
component: LoginComponent
},
{
path:'administrator',
component: AdministratorComponent,
canActivate: [AuthGuard],
children:
[
{ path: '', component: DashboardComponent },
{ path: 'contact', component: ContactComponent },
{ path: 'information', component: InformationComponent },
{ path: 'logout', component: LogoutComponent },
{ path: 'letter', component: LetterComponent },
]
},
{ path: 'home', component: HomeComponent },
{ path: 'error', component: ErrorComponent },
{
path: '**',
redirectTo: "/error"
}
];
这是我网页的模型:
并尝试访问我的 children 视图:
<button type="button" class="btn btn-success" [routerLink]="['/administrator/letter']">
Check
</button>
Note: If I access from the
AdministratorComponent
it works just like I'm wating for, but in this case I need another way to make it.
怎样才能正确访问那个视图?
我不会删除这个问题,因为这个错误或错误可能会发生在另一个人身上。在这种情况下,我忘记说在视图中我使用的是模态 window,因此模态 window 的 class 用于访问其他辅助视图的 class 保持激活状态(遮盖了正在访问的视图)
就像这样:
好的,请问如何解决?
只需要使用一个属性来关闭模态:data-dismiss
<button type="button" class="btn btn-success" data-dismiss="modal" [routerLink]="['/administrator/letter']">
Check
</button>