import { Directive, HostListener, HostBinding } from "@angular/core";
I am the beginner in angular. I am making the website in angular through the tutorial of udemy. I want to make the drop-down button. Both codes are correct. but when I click the drop-down button then the dropdown menu didn't open
`@Directive({
selector: '[appdropdown]'
})
export class DropdownDirective {
@HostBinding('class.Open') isOpen = false;
@HostListener('click') toggleOpen () {
this.isOpen = !this.isOpen;
}
}`
The HTML code and the ts code will be correct but it can not function
<ul class="nav navbar-nav justify-content-end">
<li class=" nav-item dropdown" appdropdown>
<a href="#" class=" nav-link dropdown-toggle" role="button">Manage <span
class="caret"></span> </a>
<ul class="dropdown-menu">
<li>
<a href="#"> Save Data</a>
</li>
<li>
<a href="#">Fetch Data</a>
</li>
</ul>
</li>
</ul>
Openclass appended to host on click?