加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

我可以在AngularJS中使用另一个ng-app

发布时间:2020-12-17 08:04:43 所属栏目:安全 来源:网络整理
导读:我有两个ng应用程序 喜欢 ; div ng-app="app1" somexpression div ng-app="app2" some more expression /div/div 有什么办法让它工作吗? 当我做一个嵌套的ng应用程序,它不工作 我知道我可以使用两个不同的控制器,但是我不想使用两个控制器 —-编辑—– 事
我有两个ng应用程序
喜欢 ;
<div ng-app="app1" >
    somexpression   
    <div ng-app="app2">
        some more expression
    </div>
</div>

有什么办法让它工作吗?
当我做一个嵌套的ng应用程序,它不工作

我知道我可以使用两个不同的控制器,但是我不想使用两个控制器
—-编辑—–

事情是;

angular.module('AppName',[
            'angular-carousel'
        ])

所以我需要以某种方式将这个ng应用程序更改为指令

从AngularJS文件中,答案是否定的

07000

AngularJS applications cannot be nested within each other.

如果不是嵌套的话,那就可以了,有人已经问过这个问题,请参考:AngularJS Multiple ng-app within a page
和AnguarJS文件

07000

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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读