Closed ClaudiuBadau closed 6 years ago
<ng2-dropdown>
<ng2-dropdown-button>
{{ currentMonth }}
</ng2-dropdown-button>
<ng2-dropdown-menu>
<ng2-menu-item *ngFor="let month of months" (click) = onItemClicked(month)>
{{ month }}
</ng2-menu-item>
</ng2-dropdown-menu>
</ng2-dropdown>
in your controller create a method with an onItemClicked() method with a parameter
onItemClicked(month){
console.log('item clicked ', month);
}
@ClaudiuBadau is it ok to close this one? ;)
and you where also missin the propper syntax for the snippet: it should be:
<ng2-dropdown (onItemClicked)="onItemClicked()">
yep, thank you @gangsthub
Not sure if this is possible but I have a dropdown with months and I want to be able to get the current month when I click on the item, is this possible?