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
Post a Comment