抱歉,如果这是一个菜鸟问题,但我是 Angular JS 的新手。
在编写我的网络应用程序时,我想向我的网站添加一个额外的页面。目前我有一个主模块,其中包含每个网页的较小模块:
'use strict';
angular.module('myApp', [
'ngRoute',
'myApp.view1',
'myApp.view2',
'myApp.version',
'ui.bootstrap'
]).
config(['$routeProvider', function($routeProvider) {
$routeProvider.otherwise({redirectTo: '/view1'});
}]);
这工作正常,但是当我尝试添加额外的模块“myApp.view3”时,没有页面呈现。这些模块如下所示:
查看1
angular.module('myApp.view1', ['ngRoute'])
// configuration
.config(['$routeProvider',
function ($routeProvider) {
$routeProvider.when('/view1', {
templateUrl: 'view1/view1.html',
controller: 'View1Ctrl'
});
}])//controller and factory not shown
查看3
angular.module('myApp.view3', ['ngRoute'])
.config(['$routeProvider', function ($routeProvider) {
$routeProvider.when('/view3', {
templateUrl: 'view3/view3.html',
controller: 'View3Ctrl'
});
}])
.controller('View3Ctrl', ['$scope', function($scope){
}
]);
最佳答案
抱歉,我刚刚意识到我忘记在 HTML 文件中包含 JS 脚本
关于javascript - Angular JS 添加额外模块导致项目无法渲染任何页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31198394/