Ich kämpfe mit diesem unbekannten Provider Fehler und frage mich nur, was ich falsch mache. Lassen Sie sich diese Struktur:
in main.js
'use strict';
angular.module('myApp')
.controller('MainCtrl', ['navService', function (navService) {
this.awesomeThings = [
'HTML5 Boilerplate',
'AngularJS',
'Karma'
];
this.active = false;
navService.getPosition();
}]);
In index html Ich habe ng-Controller = "MainCtrl" Und schließlich in navService:
angular.module('myApp')
.factory('navService', ['$routeProvider', '$location', function ($routeProvider, $location) {
function getPosition() {
/*code here */
}
return {
getPosition: getPosition
};
}]);
In Haupt app.js
angular
.module('cavyrApp', [
'ngAnimate',
'ngCookies',
'ngMessages',
'ngResource',
'ngRoute',
'ngSanitize',
'ngTouch'
]).config...........
haben Sie umfassen Winkel route.js im Kopfbereich? – Sankar
Haben Sie 'ngRoute' auch in die Deklaration Ihres Hauptapp-Moduls injiziert? – Lex
@SankarRaj - Ja - beide sind da – Vladyn