AngularJS - select with zero(0) value -


select options are:

`[  {statusid: 0, statusdesc: "new"},   {statusid: 10, statusdesc: "enabled"},   {statusid: 30, statusdesc: "inprogess"},  {statusid: 70, statusdesc: "done"} ];` 

in order display values have added option "all" value ""

<select id="statusid" name="statusid" ng-model="search.statusid" ng-options="status.statusid status.statusdesc status in statuslist">     <option value="">all</option> </select>     

problem on selecting new value 0 display values while selecting all displays nothing.

you can find sample code here.

you need make 2 changes..

  1. in itemslist json, status ids in string, convert them numbers.

  2. you have angular want strict comparaison. that's easy angular 1.1.5, because filter filter has third parameter, comparator, true useful shorthand.

e.g.

     <tr ng-repeat="item in itemlist | filter:search:true"> 

updated fiddle : http://jsfiddle.net/gwnfkxmc/1/


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -