相关疑难解决方法(0)

angular.js指令在不同的模块中

我很迷惑.如果我ng-app每页只能使用一次,我如何在不同的.js文件中使用位于不同模块中的指令.看:

<script src='mainModule.js'/>
<script src='secondModule.js'/>
<body ng-app='mainModule'>
   <my-thingy/>
   <div>
      <other-thingy/>
   </div> 
</body>

mainModule.js:
   angular.module("mainModule",[]).directive("myThingy",function(){ ... })

secondModule.js:
   angular.module("secondModule",[]).directive("otherThingy",function(){ ... })
Run Code Online (Sandbox Code Playgroud)

那么,我现在如何指向页面上的secondModule,而不是从mainModule.js引用它

angularjs

12
推荐指数
2
解决办法
9830
查看次数

标签 统计

angularjs ×1