HTML CODE:
<li [routerLink]="['/admin']" *allowedUIAccess="'ADMIN'"
[permissionSet]="(userprofile$ | async)?.permissions">
Admin
</li>
DIRECTIVE CODE:
@Directive({
selector: '[allowedUIAccess]'
})
export class AllowedUIAccessDirective {
@Input()
permissionSet!: string[] | undefined;
constructor(private elementRef: ElementRef,
private templateRef: TemplateRef<any>, private viewContainer: ViewContainerRef,
private uiService: UiService) {
}
@Input()
set allowedUIAccess(condition: string) {
console.log(condition);
console.log(this.permissionSet);
}
}
ERROR MESSAGE:
Error TS2322: Type '"(userprofile$ | async)?.permissions"' is not assignable to type 'string[] | undefined'.
Line 13: permissionSet="(userprofile$ | async)?.permissions">
I need help resolving this error, please point out where I am going wrong.