I have followed the following to install bootstrap 4 into my Angular 2 project: Accepted Answer, following the first 1,2,3 and 4 steps
However when I add the following <
import { Directive, HostListener, HostBinding, ElementRef } from '@angular/core';
@Directive({
selector: '[appDropdown]'
})
export class DropdownDirective {
constructor(private _el: ElementRef) {
}
@HostBinding('class.show') isOpen = false;
@HostListener('click') toggleOpen(){
this.isOpen=!this.isOpen;
if(this.isOpen){
this._el.nativeElement.querySelector('.dropdown-menu').classList.add('show');
}
else{
this._el.nativeElement.querySelector('.dropdown-menu').classList.remove('show');
}
}
}