Wednesday, November 9, 2016

custom filter $scope not defined


http://stackoverflow.com/questions/17596246/access-scope-variables-from-a-filter-in-angularjs

app.controller('AppController',
    function($scope) {
      $scope.var1 = 'This is some text.';
      $scope.var2 = 'And this is appended with custom filter.';
    }
  );


app.filter('filterReceiptsForDate', function () {
  return function (input, scope) {
    return input + ' <strong>' + scope.var2 + '</strong>';
  };
});

No comments:

Post a Comment