Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to take the value of Dropdown in ng-bootstrap?

i'm using ng-bootstrap and i want to get the value of dropdown when selected .

 <div class="col text-right">
<div ngbDropdown placement="top-right" class="d-inline-block">
  <button class="btn btn-outline-primary" id="dropdownBasic2" ngbDropdownToggle>Toggle dropup</button>
  <div ngbDropdownMenu aria-labelledby="dropdownBasic2">
    <button class="dropdown-item">Action - 1</button>
    <button class="dropdown-item">Another Action</button>
    <button class="dropdown-item">Something else is here</button>
  </div>
</div>

like image 329
o.O Avatar asked Mar 09 '23 00:03

o.O


1 Answers

You need to add a click event:

 <button class="dropdown-item" (click)="changeAction(obj)">

In the component:

changeAction(obj) {
        //your logic here
}
like image 189
ferralucho Avatar answered Mar 19 '23 02:03

ferralucho