angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

filter should be dependency injectable

Open Codier opened this issue 15 years ago • 1 comments

Currently filter is not dependency injectable, which may be a desirable feature. Also need to update docs for the following page if filter is made injectable in the future: http://docs.angularjs.org/#!/api/angular.scope.$service

Codier avatar Jul 27 '11 20:07 Codier

Yeah, this came up with Di yesterday. We should probably change the filter syntax so that the filter is a factory function just like services too. Otherwise the filter would need to be injected repeatedly for each invocation.

ex.

angular.filter('date', function($locale) {
  return function(value, format) {
     return $locale.formatDate(value, format);
  };
});

esprehn avatar Jul 28 '11 04:07 esprehn