[英]Angular JS adding an extra module causes project to not render any pages
Sorry if this is a noob question but I am brand new to Angular JS. 抱歉,如果这是一个菜鸟问题,但我是Angular JS的新手。
While programming my web app I wanted to add an extra page to my website. 在对我的Web应用进行编程时,我想向我的网站添加一个额外的页面。 Currently I have a main module that contains smaller modules for each webpage:
目前,我有一个主模块,其中包含每个网页的较小模块:
'use strict';
angular.module('myApp', [
'ngRoute',
'myApp.view1',
'myApp.view2',
'myApp.version',
'ui.bootstrap'
]).
config(['$routeProvider', function($routeProvider) {
$routeProvider.otherwise({redirectTo: '/view1'});
}]);
This works fine but when I try and add an extra module 'myApp.view3' none of the pages render. 这可以正常工作,但是当我尝试添加额外的模块“ myApp.view3”时,所有页面均无法呈现。 Here is what the modules look like:
以下是这些模块的外观:
view1 厂景
angular.module('myApp.view1', ['ngRoute'])
// configuration
.config(['$routeProvider',
function ($routeProvider) {
$routeProvider.when('/view1', {
templateUrl: 'view1/view1.html',
controller: 'View1Ctrl'
});
}])//controller and factory not shown
view 3 查看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脚本
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.