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
0
votes
1 answer

AddDevicemodalCtrl is not a function, got undefined

I am getting the error noted above, I believe this is because the controller is not attached to the module properly, however I could be wrong. Here is the controller that has been defined. (function () { 'use strict'; angular .module('WS') …
0
votes
3 answers

Can I use ng-app as an element?

Angular ToDo {{6+4}} Is this a valid angular syntax? Can I use ng-app as an…
0
votes
1 answer

angularjs module is loaded after ng-app causing nomod

I have installed phantomjs (coz i'm trying to get the system to make my website in angular crawlable), and i'm stuck on a "nomod" error which occurs only on phantomjs server (the live version works perfectly fine).
Marco
  • 1,051
  • 1
  • 17
  • 40
0
votes
4 answers

ng-repeat is not working with ng-app value

The directive ng-repeat is not working properly when we give ng-app="MyApp" and which is working without passing any value to the ng-app directive which is a strange behaviour to me. I am new to the AngularJS. Is this behaviour expected? Please…
M.S.Naidu
  • 2,239
  • 5
  • 32
  • 56
0
votes
3 answers

AngularJs doesn't work if I give a value to ng-app and ng-controller

I hope you may help me. I'm quite new with Angular so I'm maybe making some stupid error but, when a give a value to ng-app, it doesn't work AngularJs. I make here an example: This is my home.html that doesn't work (when I say "doesn't work" I mean…
user5880775
0
votes
1 answer

How to include one angularjs based SPA into another angularjs based SPA using nested ng-app which are attached to html tag?

Angular module is defined as : angular.module('module1',['ngRoute']); Route for module1 is defined as module1.config(function($routeProvider) { $routeProvider .when('/Application1', { templateUrl:…
0
votes
3 answers

Running Controller in Angular and phpStorm

I'm new to angular and I'm learnign it using phpStorm tool. It looks like I've done everything right, but I still can't get the right result when I execute the following html and Javascript codes, I did lots of researches on this and made sure that…
Sam Joni
  • 159
  • 2
  • 14
0
votes
1 answer

angularjs form not working when ng-app and ng-controller is declared in form tag

When I declare the ng-app and ng-controller the form does not do validation. If I remove them then the form does basic validation, but I want to use controller logic to perform username and password validation and routing, which I cant use (as…
akash sharma
  • 411
  • 2
  • 24
0
votes
2 answers

One single webpage to have 1 ng-app or multiple webpages to share same ng-app?

I am using angularjs 1.4 I would like to have 2 web pages for my web application. 1 web page for log-in and another web page for the main app. If user logs in correctly, he will be re-directed to the web page for the main app. I am not sure which is…
guagay_wk
  • 26,337
  • 54
  • 186
  • 295
0
votes
0 answers

Controller not linking to view

I am trying to build a contact form application, and currently I am stuck on being able to perform a scope function defined in my controller. I currently have nothing being performed by this function aside from a console.log, and that alone is not…
0
votes
2 answers

How to communicate scope data through multiple angular app?

I have separate login ng-app and index page ng-app So how would I get LoginData scope into index ng-app?
js-hint
  • 66
  • 1
  • 10
0
votes
1 answer

Why I can use `ng-bind` outside of `ng-app`?

Why I can use ng-bind outside of ng-app and ng-controller when using $rootScope.variable? faraWorkspaceApp.run(function ($rootScope, $location, $state) { $rootScope.$on('$stateChangeSuccess', function (e, toState, toParams …
Mohamad Shiralizadeh
  • 8,329
  • 6
  • 58
  • 93
-1
votes
2 answers

Why ng-app can be put in any tag?

I am new to AngularJS. I'd like to know what is the difference if I place ng-app in either tag or or
. Similarly same doubt for ng-controller .
Ritesh Gupta
  • 171
  • 1
  • 2
  • 19
-1
votes
2 answers

Which is the best way to use angular ng-app?

I am new to angular. Shoud I use the same ng-app throughout the site or should I use different ng-app directives for different pages?
Piyush Jain
  • 1,895
  • 3
  • 19
  • 40
-2
votes
2 answers

AngularJS - object values not show in {{}}

I have to show some values from a Json in the {{}} but I see the values just are shown in console and right inside app.controller. Its just going off this app.controller and the values are not shown. These are some parts of the code: var app =…
samu101108
  • 675
  • 7
  • 23
1 2 3
4