mirror of https://github.com/abpframework/abp.git
committed by
GitHub
3 changed files with 36 additions and 28 deletions
@ -1,16 +1,18 @@ |
|||
<ul class="navbar-nav"> |
|||
<li |
|||
class="nav-item d-flex align-items-center" |
|||
*ngFor="let item of navItems.items$ | async; trackBy: trackByFn" |
|||
[abpPermission]="item.requiredPolicy" |
|||
> |
|||
<ng-container |
|||
*ngIf="item.component; else htmlTemplate" |
|||
[ngComponentOutlet]="item.component" |
|||
></ng-container> |
|||
<ng-container *ngFor="let item of navItems.items$ | async; trackBy: trackByFn"> |
|||
<li |
|||
class="nav-item d-flex align-items-center" |
|||
*ngIf="item.visible()" |
|||
[abpPermission]="item.requiredPolicy" |
|||
> |
|||
<ng-container |
|||
*ngIf="item.component; else htmlTemplate" |
|||
[ngComponentOutlet]="item.component" |
|||
></ng-container> |
|||
|
|||
<ng-template #htmlTemplate> |
|||
<div [innerHTML]="item.html" (click)="item.action ? item.action() : null"></div> |
|||
</ng-template> |
|||
</li> |
|||
<ng-template #htmlTemplate> |
|||
<div [innerHTML]="item.html" (click)="item.action ? item.action() : null"></div> |
|||
</ng-template> |
|||
</li> |
|||
</ng-container> |
|||
</ul> |
|||
|
|||
@ -1,10 +1,15 @@ |
|||
import { Type } from '@angular/core'; |
|||
|
|||
export interface NavItem { |
|||
export class NavItem { |
|||
id: string | number; |
|||
component?: Type<any>; |
|||
html?: string; |
|||
action?: () => void; |
|||
order?: number; |
|||
requiredPolicy?: string; |
|||
visible?: () => boolean; |
|||
constructor(props: Partial<NavItem>) { |
|||
props = { ...props, visible: props.visible || (() => true) }; |
|||
Object.assign(this, props); |
|||
} |
|||
} |
|||
|
|||
Loading…
Reference in new issue