尝试在Angular JS中使用多个模块时遇到问题。我不能使用超过1个模块,似乎Angular无法识别代码。我愿意在应用程序上使用树视图+弹性网格,但树不会显示,只有弹性网格。我很确定我错过了一些关于modling的东西,但我不知道是什么......这是代码:
的index.htm
<html ng-app="app">
<script src="js/angular/angular.js"></script>
<script src="js/main.js"></script>
<!-- Flex Grid !-->
<script src="js/flexygrid/controllers/FlexControllers.js"></script>
<script src="js/flexygrid/directives/FlexDirectives.js"></script>
<script src="js/flexygrid/misc/FlexBlock.js"></script>
<!-- Tree !-->
<script src="js/tree/controllers/TreeControllers.js"></script>
<script src="js/tree/directives/TreeDirectives.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
main.js
var app = angular.module('app',['flexyLayout.directives','tree.controller']);
FlexControllers.js
function (angular) {
"use strict";
angular.module('flexyLayout.mediator', ['flexyLayout.block']).
controller('mediatorCtrl', ['$scope', '$element', '$attrs', 'Block', function (scope, element, attrs, Block) {
...
}
FlexDirectives.js
function (angular) {
"use strict";
angular.module('flexyLayout.directives', ['flexyLayout.mediator'])
.directive('flexyLayout', function () {
...
})(angular);
FlexBlock.js
(function (angular) {
"use strict";
angular.module('flexyLayout.block', [])
.provider('Block', function () {
...
}
})(angular);
TreeControllers.js
(function(){
angular.module('tree.controller',['angularTreeview']).controller('TreeCtrl', function($scope){
...
}
})();
TreeDirectives.js
(function(){
angular.module('angularTreeview',[]).directive('treeModel',function($compile){
...
}
})();