angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

Multiple ng-app performance

Open 29x10 opened this issue 13 years ago • 2 comments

I am using Pyramid Framework, the base template display the navbar and other pages extend it. And I put angular-bootstrap to work. So I have to define two ng-app, one for nav-bar and the other for other pages. And both of them include the angular-bootstrap.

Is it bad? Is there a workaround for this? Or I'd better not use the base and extend feature of template.

29x10 avatar Jul 17 '13 11:07 29x10

You can only use one ng-app directive per HTML page. If you are having multiple angular apps on a single page then you should manually bootstrap each one using angular.bootstrap(element, modules). This post is really a request for how to use AngularJS rather than an issue with the framework. You should probably use the mailing list or stackoverflow for this kind of question.

petebacondarwin avatar Jul 17 '13 12:07 petebacondarwin

As Peter pointed out the limitations of a single module and only one HTML per page is a limitation of the ngApp directive no the Angular framework. You could create an alternate directive without those limitations see: Getting around ngApp limitations with ngModule

As Peter mentioned you can find relevant questions at StackOverflow:

luisperezphd avatar Apr 06 '14 18:04 luisperezphd