The ability to configure stripping of traling slashes was added in AngularJS 1.3.0-beta.6.
Make sure you are not using an earlier version.
The changelog of AngularJS can be found here.
سؤال
First of all, I would like to say that i really didn't want to ask this question, but after two hours of not understanding the reason of it, it now decide to ask for some help.
I want to add the ngResource module in my app. Before doing it, everything worked well.
So I create my app like this :
var app = angular.module('app', [ 'ngResource', 'ngRoute' ]);
then i config it like this :
app.config(
[
'$resourceProvider',
'$routeProvider',
'$locationProvider',
function ($resourceProvider, $routeProvider, $locationProvider ) {
$resourceProvider.defaults.stripTrailingSlashes = false;
$locationProvider.html5Mode(false);
$routeProvider.when('/', {
templateUrl: 'templates/home.html',
controller: 'homeController'
}).when('/404', {
templateUrl: 'templates/404.html'
}).otherwise({
redirectTo: '/404'
});
}
]);
And i get this error which means :
Failed to instantiate module app due to:
TypeError: Cannot set property 'stripTrailingSlashes' of undefined
at http://localhost:3000/js/app.js:14
This error occurs when a module fails to load due to some exception. The error message above should provide additional context.
line 14 is of course :
$resourceProvider.defaults.stripTrailingSlashes = false;
The angular-resource.js is well loaded and before app.js.
I don't understand, I did it exactly like it's said on the Angular Doc :(
I hope my question isn't completely stupid and the reason is not obvious cause I really don't see where I am wrong!
Thank you if you can help me !
Bastien
المحلول
The ability to configure stripping of traling slashes was added in AngularJS 1.3.0-beta.6.
Make sure you are not using an earlier version.
The changelog of AngularJS can be found here.