coreui-angular-ex-dev
Version:
CoreUI Components Library for Angular
61 lines (51 loc) • 1.43 kB
text/typescript
import { booleanAttribute, Directive, HostBinding, Input } from '@angular/core';
export class NavLinkDirective {
/**
* Sets .nav-link class to the host. [docs]
* @type boolean
* @default true
*/
cNavLink: string | boolean = true;
/**
* Toggle the active state for the component. [docs]
* @type boolean
*/
active?: boolean;
/**
* Set disabled attr for the host element. [docs]
* @type boolean
*/
disabled: string | boolean = false;
get ariaCurrent(): string | null {
return this.active ? 'page' : null;
}
get isDisabled(): boolean | null {
return <boolean>this.disabled || null;
}
get attrDisabled() {
return this.disabled ? '' : null;
};
get getTabindex(): string | null {
return this.disabled ? '-1' : null;
}
get getCursorStyle(): string | null {
return this.disabled ? null : 'pointer';
}
get hostClasses(): any {
return {
'nav-link': this.cNavLink,
disabled: this.disabled,
active: this.active
};
}
}