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

$FilterProvider.register() accept object in addition to name/factory arguments #4036

Closed
sgoll opened this issue Sep 18, 2013 · 1 comment
Closed

Comments

@sgoll
Copy link

sgoll commented Sep 18, 2013

Right now, both $ControllerProvider.register and $CompileProvider.directive, in addition to the usual pair of name and factory/constructor arguments, accept an object as a single argument, mapping names to factory/constructor functions.

This makes it possible to initialize a bunch of controllers and directives at once, e.g. from the exports of an AMD module, by calling app.directive(require('directives')).controller(require('controllers')).

This is not possible however with $FilterProvider.register which has no special code for parsing objects – which could be as simple as forEach(name, reverseParams(register)) as in $CompileProvider.directive.

I'd like to know if there is a special reason for this and, if not, whether I should create a pull request for the proposed change.

@petebacondarwin
Copy link
Contributor

This is a good idea. Feel free to send in a PR.
You'll need to look here: https://github.com/angular/angular.js/blob/master/src/ng/filter.js#L81-L83
Don't forget that you must sign the CLA, include unit tests and make sure your commit messages are correctly formatted.
Thanks

colincasey added a commit to colincasey/angular.js that referenced this issue Sep 21, 2013
This feature adds similar functionality to what `$ControllerProvider.register` and `$CompileProvider.directive` currently provide by allowing a map of filter name/factories to be passed as the sole argument to `$FilterProvider.register` to register all of the specified filters.

Closes angular#4036
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this issue Jan 27, 2014
This feature adds similar functionality to what `$ControllerProvider.register`
and `$CompileProvider.directive` currently provide by allowing a map of filter
name/factories to be passed as the sole argument to `$FilterProvider.register`
to register all of the specified filters.

Closes angular#4036
Closes angular#4091
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this issue Jan 27, 2014
This feature adds similar functionality to what `$ControllerProvider.register`
and `$CompileProvider.directive` currently provide by allowing a map of filter
name/factories to be passed as the sole argument to `$FilterProvider.register`
to register all of the specified filters.

Closes angular#4036
Closes angular#4091
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants