1

I am new to angularjs, Is it possible to add more than one dependency module in AngularJS ?

code:

angular.module('myApp', ['dependency1','dependency2']);

I even tried this but no luck

angular.module('myApp', ['dependency1'],['dependency2']);

Any help will be highly appreciate. Thanks

1
  • Your first attempt will work. Commented May 21, 2015 at 20:44

3 Answers 3

3
angular.module('MyApp', ['dependency1','dependency2']);

is the way to add dependencies.

Advice : You should check your console and see why your code doesn't work. Let me know ;)

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

Comments

0

This is the correct way to add multiple module dependencies.

angular.module("name", ["dependencyA", "dependencyB"])

Comments

0

You were correct in your first example with

angular.module('myApp',['dependency1','dependency2']);

Make sure that the spelling is correct with these dependencies, such that if you use ngRoute and ngResource that it looks like:

angular.module('myApp',['ngRoute','ngResource']);

You will also get an error in the console if you do not add the js to your html page, so be sure to look out for that.

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.