I am using Angular 6.0.5 alongside with Bootstrap 4.1.1 and I added a directive for dropdowns. But I can't make it work in no way. I have seen a lot of similar problems here but none was for Bootstrap 4. this is the dropdown html:
<div class="btn-group" appDropdown>
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
Manage
<span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" style="cursor: pointer"
(click)="OnAddToShoppingList()">To Shopping List</a></li>
<li><a class="dropdown-item" href="#">Edit Recipe</a></li>
<li><a class="dropdown-item" href="#">Delete Recipe</a></li>
</ul>
</div>
and this is the directive:
import {Directive, HostBinding, HostListener} from '@angular/core';
@Directive({
selector: '[appDropdown]'
})
export class DropdownDirective {
@HostBinding('class.open') isOpen = false;
@HostListener('click') toggleopen() {
this.isOpen = !this.isOpen;
}
}
I suspected about the "open" class. and I think it was a depreacted class from Bootstrap 3. so what is alternative in Bootstrap 4?