aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/animation.js
diff options
context:
space:
mode:
authorMisko Hevery2013-05-01 20:55:25 -0400
committerMisko Hevery2013-05-02 15:22:16 -0400
commit80341cb9badd952fdc80094df4123629313b4cc4 (patch)
treed2b6a1f4d230de39617622a378c350433c96c7f8 /src/ng/animation.js
parent9956baedd73d5e8d0edd04c9eed368bd3988444b (diff)
downloadangular.js-80341cb9badd952fdc80094df4123629313b4cc4.tar.bz2
feat(injector): add has method for querying
Closes #2556
Diffstat (limited to 'src/ng/animation.js')
-rw-r--r--src/ng/animation.js10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/ng/animation.js b/src/ng/animation.js
index 9a5a5a95..76cf943e 100644
--- a/src/ng/animation.js
+++ b/src/ng/animation.js
@@ -51,13 +51,9 @@ function $AnimationProvider($provide) {
*/
return function $animation(name) {
if (name) {
- try {
- return $injector.get(camelCase(name) + suffix);
- } catch (e) {
- //TODO(misko): this is a hack! we should have a better way to test if the injector has a given key.
- // The issue is that the animations are optional, and if not present they should be silently ignored.
- // The proper way to fix this is to add API onto the injector so that we can ask to see if a given
- // animation is supported.
+ var animationName = camelCase(name) + suffix;
+ if ($injector.has(animationName)) {
+ return $injector.get(animationName);
}
}
}