I have a item in list with with dropdown values as ROLES. I couldn't set ng-model for drop down .if I select Actor I wanted my ng-model to be set as Actor
<li class="dropdown" ng-model="$scope.Role">
<a class="dropdown-toggle" data-toggle="dropdown">VIEW ROLE AS
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>Actor</li>
<li>Director</li>
</li>
'ng-model' only works on inputs and since the bootstrap dropdown is just a stylized list it has no real input. To get your example to work use 'ng-click' on the list elements to set 'Role'.
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown">VIEW ROLE AS
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li ng-click="setRole('Actor')">Actor</li>
<li ng-click="setRole('Director')">Director</li>
And then somewhere in the controller create the 'setRole' function.
$scope.setRole = function (role) {
$scope.Role = role;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With