Angularjs 将角度指令文件包含到index.html中可防止运行一个指令
我在索引Html文件中包含了两个简单的指令。但奇怪的是,我上面包含的文件不起作用 如果我分别将这些文件添加到index.html,则每个文件都工作正常 我的索引Html文件:Angularjs 将角度指令文件包含到index.html中可防止运行一个指令,angularjs,angularjs-directive,Angularjs,Angularjs Directive,我在索引Html文件中包含了两个简单的指令。但奇怪的是,我上面包含的文件不起作用 如果我分别将这些文件添加到index.html,则每个文件都工作正常 我的索引Html文件: <script src="app/directives/spinnerHide.js" type="text/javascript"></script> <script src="app/directives/moreInformation.js" type="text/javascript"
<script src="app/directives/spinnerHide.js" type="text/javascript"></script>
<script src="app/directives/moreInformation.js" type="text/javascript"> </script>
我的app.js文件:
angular.module('app', [
'ui.router',
'ui.bootstrap',
'ngStorage',
'app.auth',
'angular-confirm',
'angular-spinkit',
'datatables',
'toastr',
'app.directives'
]);
您要声明模块两次:
// Passing a second parameter is declaring the module
var app = angular.module('app.directives', []);
您只能声明它一次,然后在不使用第二个参数的情况下使用它
// Get the module
var app = angular.module('app.directives');
// Get the module
var app = angular.module('app.directives');