The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

352229 (9) [Avatar] Offline
#1
Hi

Can I use multiple ng-app on a single page. Because following code is not working.
 <div ng-app>
        <input type="text" ng-model="name" /><br />
        <p ng-bind="name"></p>
    </div>
     <div ng-app>
        <input type="text" ng-model="address" /><br />
        <p ng-bind="address"></p>
    </div>
Lukas Ruebbelke (107) [Avatar] Offline
#2
You cannot have multiple ng-app declaration in a single page. You can however have multiple Angular applications in a single page if you manually bootstrap the applications.

See the documentation here https://docs.angularjs.org/guide/bootstrap
352229 (9) [Avatar] Offline
#3
Hi Lukas


Thanks for the reply. But if you see this thread they are using multiple ng-app on a single page

http://stackoverflow.com/questions/18571301/angularjs-multiple-ng-app-within-a-page
Lukas Ruebbelke (107) [Avatar] Offline
#4
If you read through the accepted solution - they are manually bootstrapping the second one. Also read through the comments as the second ngApp is an anti-pattern.