AB
Должен ли файл angular.json лежать в гитигноре?
Size: a a a
AB
AV
ДП
ДП
L
ДП
L
PT
const listLink = 'list';
const login = 'login';
const vmLink = '';
const routes: Routes = [
{ path: vmLink, component: VmComponent, canActivate: [ VmGuard ], children: [
{ path: listLink, component: ListComponent },
]},
{ path: login, component: LoginComponent }
];
@NgModule({
imports: [ RouterModule.forRoot(routes) ],
exports: [ RouterModule ],
providers: [ VmGuard ]
})
export class AppRoutingModule {
listLink = listLink;
login = login;
vmLink = vmLink;
}
export class VmGuard implements CanActivate {
constructor(
private router: Router,
private authorization: AuthorizationService,
private routing: AppRoutingModule
) {
}
canActivate( next: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
const currentUser = this.authorization.currentUser;
if ( currentUser ) {
return true;
}
this.router.navigateByUrl( this.routing.vmLink );
return false;
}
}
private routing: AppRoutingModule
, выбивает ошибка Uncaught ReferenceError: Cannot access 'AppRoutingModule' before initialization
М
М
N👩
N👩
ID
ID
М
YS
YS