Questions tagged [ng-app]

Use this directive to auto-bootstrap an AngularJS application. The ngApp directive designates the root element of the application and is typically placed near the root element of the page - e.g. on the

or tags.

Use this directive to auto-bootstrap an AngularJS application. The ngApp directive designates the root element of the application and is typically placed near the root element of the page - e.g. on the or tags.

Only one AngularJS application can be auto-bootstrapped per HTML document. The first ngApp found in the document will be used to define the root element to auto-bootstrap as an application. To run multiple applications in an HTML document you must manually bootstrap them using angular.bootstrap instead. AngularJS applications cannot be nested within each other.

You can specify an AngularJS module to be used as the root module for the application. This module will be loaded into the $injector when the application is bootstrapped. It should contain the application code needed or have dependencies on other modules that will contain the code. See angular.module for more information.

In the example below if the ngApp directive were not placed on the html element then the document would not be compiled, the AppController would not be instantiated and the {{ a+b }} would not be resolved to 3.

ngApp is the easiest, and most common way to bootstrap an application.

61 questions
6
votes
3 answers

Angular 1.4.5 : Uncaught Error: [$injector:modulerr] ngRoute

When I try to refresh the page I have this error : angular.js:38 http://errors.angularjs.org/1.4.5/$injector/modulerr? p0=myApp&p1=Error%3A%2…ogleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.5%2Fangular.min.js%3A19%3A381) I have a simple module…
Nacim Idjakirene
  • 1,882
  • 8
  • 26
  • 45
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
4
votes
1 answer

Not able to understand the deleting process while writing todo list in AngularJS

I am trying to write a todo application in Angularjs in the following code. function write_controller($scope){ $scope.todos = [{text:'hey all',done:false}, {text:'hello',done:false}]; $scope.addtodo = function(){ …
mohan babu
  • 1,388
  • 2
  • 17
  • 35
4
votes
1 answer

How to share $scope between controllers with AngularJs can we access to one controller’s $scope from another controller?

can we access to one controller’s $scope from another controller? I need to get the entire data in parent,child and grandchild controller is it possible Here is my script var app = angular.module('myApp',…
Symon Kt
  • 69
  • 2
  • 4
3
votes
1 answer

angular.bootstrap error: Error: [ng:btstrpd] App Already Bootstrapped with this Element

I'm building a widget that depends on Angular along with a widget builder tool. The builder used Angular with ngApp attached to the html tag of the document. When I load up the widget within the widget builder, I get the following error: Error:…
Daniel Bonnell
  • 4,817
  • 9
  • 48
  • 88
3
votes
3 answers

Angular view performance related to ng-app/ng-controller placement in DOM

I was wondering whether I could gain any significant performance difference in my Angular app (specifically view processing) if I change ng-app and ng-controller attribute placement from i.e. body to some inner-page block element with much smaller…
Robert Koritnik
  • 103,639
  • 52
  • 277
  • 404
2
votes
0 answers

Why AngularJs 2 supports bootstrapping only through code

In AngularJs 1 there were two ways of bootstrapping your module. Automatic by ng-app Manual bootstrap by code But now when I started exploring Angular 2 I can find only one way of bootstraping it (through code).When I investigated more I found…
Rishi Tiwari
  • 1,041
  • 1
  • 10
  • 20
2
votes
3 answers

Second app is not working in angular js

Hi I am new to angular and I am trying to create 2 apps in a single HTML file but I am not getting the output for the second app and I am getting the proper output for the first app. Can anyone tell me where am I doing it wrong? The code is as…
Akshay Vasu
  • 445
  • 1
  • 12
  • 33
2
votes
2 answers

Update value of an input text when an option is selected with angularjs

I have my controller in angularjs with a array app.controller('player', function($scope) { $scope.players = [ { "id":3, "name":"Nadal", }, { "id":4, "name":"Federer" …
1
vote
1 answer

sending data to another app modul (another page) using a dblclick function in angularjs

I have two pages in my angularjs application, I get some data from database to show in a table, then i doubleclick on a row and go to another page to show more details. The problem consists on how to send data from the first page to the second one…
sansa
  • 11
  • 4
1
vote
1 answer

If the value of ng-app is not empty string the angular directives are not working

I am new to AngularJs. I am just getting confused why does my code when the value for ng-app is just empty string the Angular directives are working but on the other hand the directives are not working if the its value is not empty string. What is…
1
vote
0 answers

Trying to implement ScrollMagic to work with $anchorScroll in AngularJS

I decided to use the Single Page Application model - with a seperate controllers.js, services.js and app.js in order to create a website, which would actually stack the views on top of one another, not update the view on view change. I was basically…
1
vote
1 answer

Call multiple modules in a single page?

I created module1 and module2 in a single page. module1 is working fine, module2 is not working. Please suggest how to call module1 and module2 correctly in a single page.
Shakeer Hussain
  • 2,230
  • 7
  • 29
  • 52
1
vote
1 answer

Multiple ng-app issue

Html file Angular JS Demo
Vijay Vj
  • 347
  • 3
  • 15
1
vote
2 answers

Trying to add ng-app name does not give expected output in Application

I am trying to add an ng-app tag in my sample AngularJS application. Whenever I try to add a name like this ng-app="myapplication", the web page stops working. It is supposed to print the name entered in entry box after Hello as shown below. The…
Sreehari
  • 5,621
  • 2
  • 25
  • 59
1
2 3 4