1
我有一個index.html(主入口點)一個指令內所引用的模塊中定義的,我有一個main.js文件,說:控制器在另一個模塊
(function() {
var pop = angular.module('mainApp', []);
pop.directive = ('directive1', function() {
return {
restrict: 'E',
templateUrl: notIndex.html,
controller: // how to reference controller1 here? ,
controllerAs: controller1Alias
}
});
// pop.directives some more...
})();
我有一個notIndex.html (模板或片段),並在notMain.js定義這個網站相應的控制器說:
(function() {
var app = angular.module('app1', []);
app.controller = ('controller1', function() {
function1...
function2...
.
.
.
functionN
});
})();
所以我的問題是:
如何在notMain.js的directive1中引用controller1?
我不能在notIndex.html中有標籤(它沒有模板的標題或正文),對不對?我如何從這個html引用在notMain.js中定義的AngularJS指令?在index.html中,我想?
感謝您的幫助。
感謝您的回答。對於問題2,我是對的,