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
10
votes
2 answers

AngularJS Modules/Scope Sharing

I recently started using AngularJS and the way I'm building my apps now is like this: MainController.js var app = angular.module('app', ['SomeController', 'MainController']); app.controller('MainController', function ($scope) { // do some…
Chancho
  • 1,930
  • 2
  • 15
  • 20
9
votes
3 answers

Meaning of the empty array in angularJS module declaration

In my previous question, I understand that the code var app = angular.module('myApp', []); connects the module app to the view myApp. I would like to know why we are having the empty array [] in the module declaration. What is the empty array used…
jsh6303
  • 2,010
  • 3
  • 24
  • 50
7
votes
2 answers

List dependencies injected

Is there a way to know what dependencies were injected into my Angular module? angular.module('myModule', [ 'ui.bootstrap' ]) .controller('myController', [function () { // var dependencies = Magic.dependencies; //…
7
votes
1 answer

Dependency errors in Angular when creating an $http interceptor as a standalone module

Here is a working example of how I have set up an interceptor which attaches an authentication token to each request (this is more or less the example from https://docs.angularjs.org/api/ng/service/$http) angular.module("app", []) .config(function…
7
votes
2 answers

Angular Module Private Members

In AngularJS, is it possible to create private controllers or services which can be used within the module they are defined in, but not by another module they are injected into. For example, can PrivateController be made private to the Child…
Michael Allan Jackson
  • 4,217
  • 3
  • 35
  • 45
6
votes
1 answer

Why must a provider be defined before a config block

I have a module. It has a config block, a provider, and a constant defined. The config block references both the constant and the provider. I notice that my constant can be defined before or after my config block. The provider however must be…
Selah
  • 7,728
  • 9
  • 48
  • 60
6
votes
2 answers

AngularJs Lazy Loadng without RequireJS

In a large scale application, How do we lazy load modules, controllers, services whenever needed without loading those in the index.html. Here I'm referring to load the entire js in the relevant template html and not in the index.html. (It could be…
kds
  • 28,155
  • 9
  • 38
  • 55
5
votes
5 answers

Angular.js Controller Not Working

I'm new to Angular and I'm going through the Intro to Angular videos from the Angular site. My code isn't working and I have no idea why not. I get the error Error: ng:areq Bad Argument Argument 'MainController' is not a function, got…
Halcyon
  • 14,631
  • 17
  • 68
  • 99
5
votes
2 answers

controller function in angularjs?

I am new to angular js Controller is not working correctly in my code i am trying to run following code Using AngularJS Directives and Data binding name
user3946530
5
votes
1 answer

Loading Module After Angular Bootstrap

I am trying to load and inject a module after app bootstrap. For example let's say my initial module is: angular.module('mainApp', []); Later on I realize the user needs all of the routes available via secondaryApp to open up to them. So now I…
5
votes
1 answer

How do you call your module's controller function from an entirely separate module's controller?

I'm just getting to grips with Angular, but passing around scope is getting the better of me when I try to abstract reusable components into separate modules. I'm using an Angular Youtube module found here…
4
votes
1 answer

Can't include ngMessages Module in Angularjs application after bower install

I'm having a lot of trouble trying to install and import the angular-messages module in an angularjs project. Here is the error message Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to: Error: [$injector:modulerr]…
ethand320
  • 145
  • 2
  • 8
4
votes
2 answers

Correct way of wrapping javascript class in AngularJS module and inject angular services

Inside an AngularJS module I'm developing, I have a Canvas class defined as: angular.module("myModule", []) .factory("Canvas", function() {return Canvas;}); var Canvas = function(element, options) { this.width = options.width || 300; …
Andrea Aloi
  • 971
  • 1
  • 17
  • 37
4
votes
1 answer

AngularJS: uncaught object because of services and modules dependencies

I have a 'maps-services' module with a 'MapService' service as below: angular.module('maps-services', []) .service('MapService', [$log, function($log) { this.initMap = function() { } this.updateMap = function() { } }]); I also…
user3181983
  • 153
  • 1
  • 4
  • 13
3
votes
1 answer

How to bootstrap two Modules using bootstrapModule() in Angular2?

Normally this is how a Module is integrated or bootstrapped with the main.ts. import {platformBrowserDynamic} from'@angular/platform-browser-dynamic' import {AppModule} from './app.module' platformBrowserDynamic().bootstrapModule(AppModule) But…
sigdelsanjog
  • 528
  • 1
  • 11
  • 30
1
2
3
12 13