AngularJs : Creating multiple ng-app in single page

  • Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome.
  • We have detected you are using Google Chrome and might be unable to use the Java plugin from this browser.
  • AngularJs : Creating multiple ng-app in single page
  • In the method a root ng-app is created within or tag then define other multiple ng-app and inject them in root ng-app as dependencies.
  • In the method, first ng-app is auto-bootstrapped by Angular and the second ng-app module is bootstrapped manually.

Blogs posted in Javascript. The title is AngularJs : Creating multiple ng-app in single page – Find Nerd

@FindNerd2: Learn how to Create multiple ng-app in a single page. #angular2 #angularjs #javascript…

In above program two ng-app named primaryApp and secondaryApp with their own controller named primaryController and secondaryController are created. These controllers have their own  scope variable “name”. When above program runs then output is as follows :

This shows that only the first ng-app will work as a result “primaryApp” work as expected whereas “secondaryApp” does not. There are various ways for running multiple ng-app in an HTML document.

Method 1: Inject modules in the root app as dependencies

Method 2 : Bootstrap the defined second module manually.

In this method, first ng-app is auto-bootstrapped by Angular and the second ng-app module is bootstrapped manually.

AngularJs : Creating multiple ng-app in single page

You might also like More from author

Comments are closed, but trackbacks and pingbacks are open.