Difference between Angular's canLoad and canActivate?

前端 未结 7 1343
梦谈多话
梦谈多话 2020-12-12 13:12

What is the difference between canLoad and canActivate?

export interface Route {
  path?: string;
  pathMatch?: string;
  matcher?:         


        
7条回答
  •  时光取名叫无心
    2020-12-12 14:08

    canActivate is used to prevent an unauthorized user

    canLoad is used to prevent the entire module of app

    Example of canActivate:

    { path: 'product',canActivate:[RouteGaurd], component : ProductComponent }
    

    Example of canLoad:

    { path: 'user' , canLoad: [AuthenticGuard], loadChildren : './user/user.module#UserModule' }
    

提交回复
热议问题