Building and Using A Dropdown Directive
Building and Using A Dropdown Directive
ng g directive dropdown
-in toggleOpen(){} we access our isOpen property and assign it to below value
-we need to attached the css class called open dynamically with @HostBinding on
our property'
must be imported as well.
-our css class open will only be attached dynamically on our element if ti will
become true.
and it will become true once we have click our our dropdown button.
when switches to false it will be removed.
********
@Directive({
selector: '[appDropdown]'
})
export class DropdownDirective {
constructor() { }
@HostListener("click") toggleOpen() {
this.isOpen = !this.isOpen;
}