javascript - filter function ng-repeat returning true but 0 results are displayed -


i have custom function returns true or false

controller function:

    this.isstoreequipment = function(equipment){         var returnval = false         if (array.isarray(equipment)){             equipment.foreach(function(piece, index, array){                 if (config.myequipment().indexof(piece)!= -1){                     returnval = true                     return                 }             });                      }         return returnval     } 

and in table

        <tr ng-cloak id="{{$index}}"             ng-repeat-start="equipment in currentcontroller.storeequipment | orderby: '-lastservice ' | filter: currentcontroller.isstoreequipment(equipment.storenum))>"             <td>{{equipment.lastservice | date:'mm/dd/yyyy'}}</td>             <td>{{equipment.type}}</td>             <td>{{equipment.name}}</td>             <td>{{equipment.storenum}}</td>         </tr> 

now have validated return true adding <td>currentcontroller.isstoreequipment(equipment.storenum) table , returning true , false should, not getting results filter applied ng-repeat expression.

you should register filters this:

 angular.module('test').filter('instore', function() {   return function(input) {     ....   } }); 

they're more general functions, usable in more 1 controller. said, input value on you're applying filter. in case it's array , filter should return new array 'good' items.

here's nice example https://stackoverflow.com/a/15197233/3927379


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -