2014-09-05 2 views
1

Как вы добавляете больше видов в проект с угловым посевом?Добавление представлений в проект с угловым посевом

Я только начал этот проект и захотел добавить больше просмотров, поэтому скопировал папку 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) 

ответ

4

Вам также нужно загрузить скрипт view3.js в свой index.html.

+0

haha ​​... doh! Спасибо, человек! – thehindutimes

+1

Я тоже был глуп. : D Stackoverflow также нуждается в таких вопросах. – Daniel

Смежные вопросы