why not utilize (openChange) instead???? Check out this StackBlitz example
<div #drop1 ngbDropdown (openChange)="checkDropDown($event,1)">
<button class="btn btn-outline-primary" ngbDropdownToggle >Toggle-1</button>
<div ngbDropdownMenu aria-labelledby="dropdownConfig">
<button ngbDropdownItem>Action - 1</button>
<button ngbDropdownItem>Another Action</button>
<button ngbDropdownItem>Something else is here</button>
</div>
</div>
If we want to reference the dropdown element, we can do so like this
<div #drop1="ngbDropdown"
ngbDropdown (openChange)="checkDropDown($event,drop1)">
....
</div>
checkDropDown(open:boolean,dropdown: NgbDropdown) {
console.log(open,dropdown.placement)
}
UPDATE: For detailed information about ngbDropdown, refer to the official documentation here. The API may be complex, so let's summarize it succinctly.
Inputs are properties that can be added in .html as shown below
<div ngbDropdown [propertie]="variable"..>
//or
<div ngbDropdown propertie="value" ...>
//if it's a string, remember to use single quotes e.g.
<div ngbDropdown autoClose="'outside'" ...>
Outputs represent "events", and if they return a value, we capture the response using $event, for example
<div ngbDropdown (openChange)="myFunction($event)" ...>
//If additional arguments need to be sent, simply add them
<div ngbDropdown (openChange)="myFunction($event,"some more")" ...>
Methods are functions that can be used in the .ts file if we have ViewChild or ViewChildren defined
<div #myngbDropdown ngbDropdown [propertie]="variable"..>
@ViewChild('myngbDropDown') mydrop:nhbDropDown;
ngOnAtferView()
{
console.log(this.mydrop.isOpen())
}