import { eIdentityComponents } from '@abp/ng.identity'; // imported eIdentityComponents enum
import { eIdentityComponents } from '@abp/ng.identity'; // imported eIdentityComponents enum
import { Store } from '@ngxs/store'; // imported Store
import { Store } from '@ngxs/store'; // imported Store
//...
//...
export class AppComponent {
@Component(/* component metadata */)
export class AppComponent implements OnInit {
constructor(..., private store: Store) {} // injected Store
constructor(..., private store: Store) {} // injected Store
ngOnInit() {
ngOnInit() {
// added dispatch
this.store.dispatch(
this.store.dispatch(
new AddReplaceableComponent({
new AddReplaceableComponent({
component: YourNewRoleComponent,
component: YourNewRoleComponent,
key: eIdentityComponents.Roles,
key: eIdentityComponents.Roles,
}),
}),
);
);
//...
//...
}
}
}
}
@ -35,11 +39,11 @@ export class AppComponent {
## How to Replace a Layout
## How to Replace a Layout
Each ABP theme module has 3 layouts named `ApplicationLayoutComponent`, `AccountLayoutComponent`, `EmptyLayoutComponent`. These layouts can be replaced with the same way.
Each ABP theme module has 3 layouts named `ApplicationLayoutComponent`, `AccountLayoutComponent`, `EmptyLayoutComponent`. These layouts can be replaced the same way.
> A layout component template should contain `<router-outlet></router-outlet>` element.
> A layout component template should contain `<router-outlet></router-outlet>` element.
The below example describes how to replace the `ApplicationLayoutComponent`:
The example below describes how to replace the `ApplicationLayoutComponent`:
Run the following command to generate a layout in `angular` folder:
Run the following command to generate a layout in `angular` folder:
@ -55,7 +59,7 @@ Add the following code in your layout template (`my-layout.component.html`) wher
<router-outlet></router-outlet>
<router-outlet></router-outlet>
```
```
Open the `app.component.ts` and add the below content:
Open `app.component.ts` in `src/app` folder and modify it as shown below:
```js
```js
import { ..., AddReplaceableComponent } from '@abp/ng.core'; // imported AddReplaceableComponent
import { ..., AddReplaceableComponent } from '@abp/ng.core'; // imported AddReplaceableComponent