Questions tagged [angularjs-module]

The angular.module is a global place for creating, registering and retrieving Angular modules. All modules (angular core or 3rd party) that should be available to an application must be registered using this mechanism.

From Angularjs documentation:

The angular.module is a global place for creating, registering and retrieving Angular modules. All modules (angular core or 3rd party) that should be available to an application must be registered using this mechanism.

187 questions
1111
votes
15 answers

What is the difference between angular-route and angular-ui-router?

I'm planning to use AngularJS in my big applications. I'm in the process to find out the right modules to use. What is the difference between ngRoute (angular-route.js) and ui-router (angular-ui-router.js) modules? In many articles when ngRoute is…
77
votes
6 answers

Is there a way in AngularJS to define constants with other constants?

I'm trying to define constants with other constants, but it seems that it can't be done, because the initial constant isn't ready when the required constant depending require it. I want to be sure if this isn't possible at all. Currently I have…
raulricardo21
  • 2,499
  • 4
  • 20
  • 27
49
votes
4 answers

Modules and namespace / name collision in AngularJS

Consider the following jfiddle http://jsfiddle.net/bchapman26/9uUBU/29/ //angular.js example for factory vs service var app = angular.module('myApp', ['module1', 'module2']); var service1module = angular.module('module1',…
Brian Chapman
  • 1,334
  • 2
  • 12
  • 17
43
votes
7 answers

How to check for the existence of a module without an error being raised?

In Angular 1.2, ngRoute is a separate module so you can use other community routers like ui.router instead. I'm writing an open-source module that aims to work for multiple different router implementations. So how can I check which router is loaded…
XåpplI'-I0llwlg'I -
  • 21,649
  • 28
  • 102
  • 151
35
votes
2 answers

AngularJS - module dependencies, naming clash

I have two third-party modules, both defining a factory with the same name. Obviously, I don't have any control over the naming of those modules without resorting to a kludge. Additionally, I have two further, internal modules, each using a…
Michal Ostruszka
  • 2,089
  • 2
  • 20
  • 23
28
votes
2 answers

How to use two AngularJS services with same name from different modules?

Supposed I have two modules for AngularJS, e.g. foo and bar, and both of them define a service called baz. In my application I depend on them by saying: var app = angular.module('app', [ 'foo', 'bar' ]); Then I can try to use the baz service in a…
Golo Roden
  • 140,679
  • 96
  • 298
  • 425
21
votes
1 answer

How to share data between two modules in AngularJS?

I am using AngularJS along with c# mvc. I have a home page where user enters some data and that should be passed to the second module where I use this data for processing and decisions. I have to use the data entered or updated in the first module…
KDKR
  • 365
  • 2
  • 3
  • 11
21
votes
7 answers

AngularJS: Uncaught Error: [$injector:modulerr] Failed to instantiate module?

I am new to AngularJS and working my way through some documents and tutorials to learn. My question is in reference to Egghead's video series, this video in particular, demonstrating how to put together a basic search filter. I wanted to use this…
code-sushi
  • 719
  • 3
  • 7
  • 23
21
votes
5 answers

Is it possible to override constants for module config functions in tests?

I've spent quite a while banging my head against trying to override injected constants provided to modules' config functions. My code looks something like common.constant('I18n',
Joe Drew
  • 211
  • 1
  • 2
  • 4
18
votes
2 answers

Using a factory inside another factory AngularJS

I have a module... angular.module('myModule', []); And then a factory angular.module('myModule') .factory('factory1', [ function() { //some var's and functions } ]); And then another factory angular.module('myModule') .factory('factory2', [ …
user1876246
  • 1,219
  • 5
  • 18
  • 33
15
votes
1 answer

How to declare sub-modules in AngularJS

When working on large projects in AngularJS, I found that I like organizing code by functionality. That means that when I have some recognizable functionality X (especially if it is reusable) I create directory X and put into it all controllers,…
Martinsos
  • 1,663
  • 15
  • 31
15
votes
3 answers

Module not found in angularjs

I want to wrap this https://gist.github.com/nblumoe/3052052 in a module. I just changed the code from TokenHandler to UserHandler, because on every api request I want to send the user ID. However I get module UserHandler not found in firebug…
DarkLeafyGreen
  • 69,338
  • 131
  • 383
  • 601
13
votes
2 answers

karma.conf.js uncaught referencerror: google no defined

when i try running the karma test runner, i'm getting a error as the following from one of my files, saying that my library google is undefined??? Chrome 36.0.1985 (Mac OS X 10.9.4) ERROR Uncaught ReferenceError: google is not defined at…
11
votes
1 answer

How should I make configurable modules in AngularJS

I've been tinkering with AngularJS and I've built up a small collection of directives and services that I would like to package into a single JS file so that I can use them anywhere. I have some website specific settings that my module will need for…
Joshua Walsh
  • 1,915
  • 5
  • 25
  • 50
10
votes
1 answer

Angularjs - how to correct inject service from another module that is not depending?

I didn't understand how work modular depending. I have 3 modules, they are dependent on each other, as shown in the picture. "App" module includes "module1" and "module2". "module2" includes "core" module. There are source on…
iKBAHT
  • 644
  • 6
  • 17
1
2 3
12 13