Hello I have a problem, I really don’t know why.
My app is named : GroupePrive
Error: [$injector:modulerr] Failed to instantiate module GroupePrive due to:
[$injector:modulerr] Failed to instantiate module ngRoute due to:
[$injector:nomod] Module 'ngRoute' 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.3.13/$injector/nomod?p0=ngRoute
.......
.......
.......
Why ? Please help me !
Slawko
April 16, 2015, 1:51pm
2
I guess the problem is in your app.js. Can you show it?
var app=angular.module('GroupePrive', ['ionic','ngRoute']);
app.
run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
})
app.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/login', {
templateUrl: 'partials/login.html',
controller: 'loginCtrl'
});
$routeProvider.when('/dashboard', {
templateUrl: 'partials/dashboard.html',
controller: 'dashboardCtrl'
});
$routeProvider.otherwise({redirectTo: '/login'});
}]);
//***** POP UP De validation **** //
app.
controller('PopupCtrl',function($scope, $ionicPopup, $timeout) {
// An alert dialog : Confirmation de réservation
$scope.showAlertAcceptation = function() {
var alertPopup = $ionicPopup.alert({
title: 'Réservation acceptée',
template: 'Vous venez d\'accepter cette réservation',
buttons: [{
text: 'OK',
type: 'button-balanced'
}]
});
alertPopup.then(function(res) {
console.log('Réservation acceptée');
});
};
// An alert dialog : Confirmation de réservation
$scope.showAlertConfirmation = function() {
var alertPopup = $ionicPopup.alert({
title: 'Réservation confirmée',
template: 'Vous venez de confirmer cette réservation',
buttons: [{
text: 'OK',
type: 'button-balanced'
}]
});
alertPopup.then(function(res) {
console.log('Réservation confirmée');
});
};
// An alert dialog : Refus de la réservation
$scope.showAlertRefus = function() {
var alertPopup = $ionicPopup.alert({
title: 'Réservation refusée',
template: 'Vous venez de refuser cette réservation',
buttons: [{
text: 'OK',
type: 'button-assertive'
}]
});
alertPopup.then(function(res) {
console.log('Réservation refusée');
});
};
// A confirm dialog
$scope.showConfirmRefus = function() {
var confirmPopup = $ionicPopup.confirm({
title: 'Refuser la réservation',
template: 'Vous êtes sûr de refuser cette réservation?',
cancelText: 'Fermer',
okText: 'Refuser',
okType: 'button-assertive'
});
confirmPopup.then(function(res) {
if(res) {
console.log('Réservation refusée');
$scope.showAlertRefus();
} else {
console.log('Réservation non refusée');
console.log(res);
}
});
};
$scope.showConfirmConfirmation = function() {
var confirmPopup = $ionicPopup.confirm({
title: 'Confirmer la réservation',
template: 'Vous êtes sûr de confirmer cette réservation?',
cancelText: 'Fermer',
okText: 'Oui',
okType: 'button-balanced'
});
confirmPopup.then(function(res) {
if(res) {
console.log('Réservation confirmée');
$scope.showAlertConfirmation();
} else {
console.log('Réservation non confirmée');
console.log(res);
}
});
};
});
prototypeprod:
ngRoute
why do you need ngRoute? it is not included in your index.html, and ionic bundle comes with ui-router already…
I found this : https://github.com/amineeg/sessions-angularJs
It works perfectly, but when i try to adapt it on my Ionic app it doesn’t work
yurinondual:
ngRoute
remove ngRoute from your dependency injection
When I remove it I get this error :
Error: [$injector:modulerr] Failed to instantiate module GroupePrive due to:
[$injector:unpr] Unknown provider: $routeProvider
http://errors.angularjs.org/1.3.13/$injector/unpr?p0=%24routeProvider
minErr/<@http://localhost/App/app/lib/ionic/js/ionic.bundle.js:8346:12
createInjector/providerCache.$injector<@http://localhost/App/app/lib/ionic/js/ionic.bundle.js:12280:19
.......
.......
.......
Because Ionic doesn’t come with ngRoute by default, but uses ui-router you have 2 options
Put back ngRoute in dependency injection and download ngRoute script, and reference it in your index.html
Use ui-router stateProvider instead of routeProvider
Even when i reference it in my index.html I get the same error message.
<script src="lib/angular/angular-route.js"></script>
I think the best solution is to use ui-router instead of routeProvider, but how can I do that ? Excuse me but I’m beginner at AngluarJS
I faced this problem…but I solved it
this file was in comment in my index.html so I was faced this problem