将视图添加到角度种子项目
Adding views to angular-seed project
如何向Angular种子项目添加更多视图?
我刚开始这个项目,想添加更多视图,所以我复制了view2文件夹并将其重命名为view3(对包含view2变量的文件夹中的所有文件都做了同样的操作),然后将其添加到模块中。
angular.module('myApp', [
'ngRoute',
'myApp.view1',
'myApp.view2',
'myApp.view3',
'myApp.version'
]).
config(['$routeProvider', function($routeProvider) {
$routeProvider.otherwise({redirectTo: '/view1'});
}]);
view3.js文件如下所示:
'use strict';
angular.module('myApp.view3', ['ngRoute'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/view3', {
templateUrl: 'view3/view3.html',
controller: 'View3Ctrl'
});
}])
.controller('View3Ctrl', [function() {
}]);
你还需要做其他与角度种子相关的事情吗?因为我在重新加载页面时会出现这些错误,我真的不知道从哪里开始。一直在Bower_components文件夹中查找,但其中似乎没有任何您应该更改的内容。
第三排讲的是装载,但装载在哪里?
Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to:
Error: [$injector:modulerr] Failed to instantiate module myApp.view3 due to:
Error: [$injector:nomod] Module 'myApp.view3' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.2.23/$injector/nomod?p0=myApp.view3
at http://localhost:8000/app/bower_components/angular/angular.js:78:12
at http://localhost:8000/app/bower_components/angular/angular.js:1677:17
at ensure (http://localhost:8000/app/bower_components/angular/angular.js:1601:38)
at module (http://localhost:8000/app/bower_components/angular/angular.js:1675:14)
at http://localhost:8000/app/bower_components/angular/angular.js:3878:22
at forEach (http://localhost:8000/app/bower_components/angular/angular.js:325:18)
at loadModules (http://localhost:8000/app/bower_components/angular/angular.js:3872:5)
at http://localhost:8000/app/bower_components/angular/angular.js:3879:40
at forEach (http://localhost:8000/app/bower_components/angular/angular.js:325:18)
at loadModules (http://localhost:8000/app/bower_components/angular/angular.js:3872:5)
http://errors.angularjs.org/1.2.23/$injector/modulerr?p0=myApp.view3&p1=Err…ocalhost%3A8000%2Fapp%2Fbower_components%2Fangular%2Fangular.js%3A3872%3A5)
at http://localhost:8000/app/bower_components/angular/angular.js:78:12
at http://localhost:8000/app/bower_components/angular/angular.js:3906:15
at forEach (http://localhost:8000/app/bower_components/angular/angular.js:325:18)
at loadModules (http://localhost:8000/app/bower_components/angular/angular.js:3872:5)
at http://localhost:8000/app/bower_components/angular/angular.js:3879:40
at forEach (http://localhost:8000/app/bower_components/angular/angular.js:325:18)
at loadModules (http://localhost:8000/app/bower_components/angular/angular.js:3872:5)
at createInjector (http://localhost:8000/app/bower_components/angular/angular.js:3812:11)
at doBootstrap (http://localhost:8000/app/bower_components/angular/angular.js:1444:20)
at bootstrap (http://localhost:8000/app/bower_components/angular/angular.js:1459:12)
http://errors.angularjs.org/1.2.23/$injector/modulerr?p0=myApp&p1=Error%3A%…calhost%3A8000%2Fapp%2Fbower_components%2Fangular%2Fangular.js%3A1459%3A12)
您还需要在index.html中加载view3.js脚本。
相关文章:
- java中具有长种子值的随机数生成器
- 使用Jquery.click显示/隐藏切换,适用于新用户,但不适用于种子
- 将范围添加到角度种子默认视图控制器时,测试套件现在失败
- AngularJs/GitHub :如何在没有任何历史记录的情况下将角度种子克隆到我的新项目中
- 角度种子克隆的“npm start”命令中出错
- 聚合物种子-自定义元素依赖关系
- AngularJS/Protactor:使用角种子基本应用程序运行量角器时出错
- 流星随机包vs随机种子
- 构建项目时,在服务器上找不到子项目
- 角度种子项目 - 角度加载器-js 依赖项
- 构建 gulp 子项目
- 从种子号码创建电话号码
- 使用 heroku 运行 angularjs 种子应用程序时出错
- Phonegap 3.0,Cordova CLI:创建ios子项目时出错
- Knex 迁移种子设定完成,但出现外键错误
- 使用 Javascript Jquery 将鼠标悬停在主项目上时显示子项目
- 从网址下载种子文件
- 为什么应用程序生成器会在 npm 而不是 yeoman 上?(即角种子)Github vs npm vs Yeoman
- 带有 Rails 3.1 的 AngularJS - 加载 Angular 种子时遇到问题
- IndexedDB:如何将自动增量密钥重新设定种子/重置为 0(或 1)