angularjs - passing argument to filter not in html template -


we can pass arguments filter in template such as:

<li ng-repeat="friend in friends | somefilter:var1"> 

for

 angular.module('myapp.filters', [])     .filter('somefilter', function () {         return function (input, var1) {              return var1;         }      }); 

but how pass variable when filter assigned in controller, when dont have access internal template of component using. example ui-grid column has cellfilter property.

for example want pass data $resource filter

if have in template :

<li ng-repeat="friend in friends | somefilter:var1"> 

you'll have in controller :

$filter('somefilter')(friend, var1); // $filter('filtername')(filteredvalue, args) 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -