Rohìt Jíndal
Rohìt Jíndal

Reputation: 27202

Multiple Dependency Module in Angularjs

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

Upvotes: 1

Views: 2659

Answers (3)

Zach Stoltz
Zach Stoltz

Reputation: 223

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.

Upvotes: 0

Nicolas2bert
Nicolas2bert

Reputation: 1152

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

Upvotes: 3

Dennis
Dennis

Reputation: 4017

This is the correct way to add multiple module dependencies.

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

Upvotes: 0

Related Questions