|
|
|
@ -55,7 +55,9 @@ The directive can also be used as an attribute directive but we recommend to you |
|
|
|
|
|
|
|
You can use `PermissionGuard` if you want to control authenticated user's permission to access to the route during navigation. |
|
|
|
|
|
|
|
Add `requiredPolicy` to the `routes` property in your routing module. |
|
|
|
* Import the PermissionGuard from @abp/ng.core. |
|
|
|
* Add `canActivate: [PermissionGuard]` to your route object. |
|
|
|
* Add `requiredPolicy` to the `data` property of your route in your routing module. |
|
|
|
|
|
|
|
```js |
|
|
|
import { PermissionGuard } from '@abp/ng.core'; |
|
|
|
@ -66,9 +68,7 @@ const routes: Routes = [ |
|
|
|
component: YourComponent, |
|
|
|
canActivate: [PermissionGuard], |
|
|
|
data: { |
|
|
|
routes: { |
|
|
|
requiredPolicy: 'AbpIdentity.Roles.Create', |
|
|
|
}, |
|
|
|
requiredPolicy: 'YourProjectName.YourComponent', // policy key for your component |
|
|
|
}, |
|
|
|
}, |
|
|
|
]; |
|
|
|
|