Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

filter should be dependency injectable #490

Closed
Codier opened this issue Jul 27, 2011 · 1 comment
Closed

filter should be dependency injectable #490

Codier opened this issue Jul 27, 2011 · 1 comment
Milestone

Comments

@Codier
Copy link
Contributor

Codier commented Jul 27, 2011

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

@esprehn
Copy link
Contributor

esprehn commented Jul 28, 2011

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);
  };
});

@btford btford closed this as completed Oct 8, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants