有多少NG-应用程序可在角JS声明吗? [英] How many ng-App can be declared in in Angular JS?

查看:100
本文介绍了有多少NG-应用程序可在角JS声明吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

How many ng-App attributes can be declared in in Angular JS? and under what circumstances? 

据我知道,NG-应用程序用于自动引导一个角度JS应用程序。

As I know that ng-app is used for auto bootstrap for an Angular JS application.

推荐答案

<一个href=\"http://docs.angularjs.org/api/ng.directive:ngApp\">http://docs.angularjs.org/api/ng.directive:ngApp

只有一个AngularJS应用程序可以自动自举每个HTML文档。第一ngApp在文档中找到将被用于定义根元素自动引导作为一个应用程序。要运行一个HTML文档必须使用angular.bootstrap,而不是手动引导他们在多个应用程序。 AngularJS应用程序不能相互嵌套。

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.

TL; DR:你可以有多个,但只有第一个会被自举

TL; DR: you can have more than one, but only the first will be bootstrapped.

此问题是类似于:

  • How to define two angular apps / modules in one page?
  • Multiple ng-app directives on a page
  • AngularJS Multiple ng-app within a page

这篇关于有多少NG-应用程序可在角JS声明吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆