0

I have 3 modules. The main app module and two directive modules. All modules are dependent on ngAnimate.

How should I best include the ngAnimate?

In the first main app module only, like the code below? Here it looks as they are in one file, but they are really in 3 different files.

angular.module('app', ['ngAnimate','someDirectiveModule','someOtherDirectiveModule']);
angular.module('someDirectiveModule', []);
angular.module('someOtherDirectiveModule', []);

Or separately in each module that is dependent on ngAnimate (which in this case is all modules)? Like this:

angular.module('app', ['ngAnimate','someDirectiveModule','someOtherDirectiveModule']);
angular.module('someDirectiveModule', ['ngAnimate']);
angular.module('someOtherDirectiveModule', ['ngAnimate']);
1
  • 1
    1st option would be preferable as per me, injecting it one time will be better than injecting ngAnimate thrice Commented Apr 15, 2015 at 7:07

2 Answers 2

1

@EricC Does your first approch work? I doubt. It is mandatory to inject dependencies in every module that needs it.

Sign up to request clarification or add additional context in comments.

1 Comment

When I think of it, I probably have not, just assumed that it would work. Thanks!
0
angular.module('app', ['ngAnimate','someDirectiveModule','someOtherDirectiveModule']);
angular.module('app', ['ngAnimate','someDirectiveModule','someOtherDirectiveModule']);
angular.module('someOtherDirectiveModule', ['ngAnimate']);

if you'll use "someDirectiveModule" or "someOtherDirectiveModule" in other app without "ngAnimate"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.