import { Directive, Input, TemplateRef, ViewContainerRef } from '@angular/core';
import { ZuiPermissionService } from './index.service';
export class ZuiPermissionDirective {
    constructor(templateRef, viewContainerRef, zuiPermissionService) {
        this.templateRef = templateRef;
        this.viewContainerRef = viewContainerRef;
        this.zuiPermissionService = zuiPermissionService;
    }
    set zuiPermission(permission) {
        // console.log('val', permission)
        if (!permission) {
            this.viewContainerRef.createEmbeddedView(this.templateRef);
            return;
        }
        const permissionObj = this.zuiPermissionService.permission;
        if (permissionObj[permission]) {
            this.viewContainerRef.createEmbeddedView(this.templateRef);
        }
    }
}
ZuiPermissionDirective.decorators = [
    { type: Directive, args: [{ selector: '[zuiPermission]' },] }
];
ZuiPermissionDirective.ctorParameters = () => [
    { type: TemplateRef },
    { type: ViewContainerRef },
    { type: ZuiPermissionService }
];
ZuiPermissionDirective.propDecorators = {
    zuiPermission: [{ type: Input }]
};
//# sourceMappingURL=index.directive.js.map