我有两个不同的模块,第一个包含控制器第二个指令。
基本上我希望directive
在我的view
. 但至于modules
和directive
不同controller
,其给出错误。
如果我给出相同module
的结果,那么它通过我想要一个为所有控制器服务的通用模块来解决我的问题。
controller
angular.module('SlamModuleCtrl')
.controller('SlambookExt',['$scope','$route','SlambookCollection', function($scope,$route) {
console.log("slam controller")
}]);
Directive
angular.module('Genericmodule')
.directive('appVersion', ['version', function (version) {
return {
restrict: 'E',
template: '<h1>version1</h1>'
}
}])
View
<div ng-controller="SlambookExt">
<app-version>1</app-version>
</div>