Using ng-hide or ng-show on select box option

ThinkingInBits picture ThinkingInBits · Sep 9, 2013 · Viewed 27.3k times · Source

Is it possible to hide select box options using the ng-hide directive?

http://jsfiddle.net/cr4UB/

<div ng-app ng-controller="Controller">
    <select ng-model="myDropDown">
          <option value="one">One</option>
          <option value="two" ng-hide="myDropDown=='one'">Two</option>
          <option value="three">Three</option>
    </select>

    {{myDropDown}}
</div>

Answer

Chandermani picture Chandermani · Sep 9, 2013

AngularJS 1.1.5 has a directive ng-if which can work for you. Check this fiddle http://jsfiddle.net/cmyworld/bgsVw/