我正在嘗試使用角度種子項目(https://github.com/angular/angular-seed)啓動一個新項目。我正在嘗試添加新的指令。AngularJS角度種子啓動器項目添加指令
創建testDirective.js文件:
'use strict';
angular.module("myApp.testDirective", [])
.directive("testDirective",
function() {
return {
template : "<h1>Made by a directive!</h1>"
};
});
列入的index.html文件,添加 「myApp.testDirective」 到app.js,在view1.js我說:
'use strict';
angular.module('myApp.view1', ['ngRoute','myApp.testDirective'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/view1', {
templateUrl: 'view1/view1.html',
controller: 'View1Ctrl'
});
}])
.controller('View1Ctrl', [function() {
}]);
和view1.html看起來像:
<p>This is the partial for view 1.</p>
<div testDirective></div>
但是,當我運行該應用程序,什麼都沒有顯示testDirective的地方。不知道我出錯的地方。
謝謝!我忘了所有關於... – erichardson30