Initially, I was hesitant to ask this question, but after struggling for two hours without any success, I've decided to seek some assistance.
I'm trying to integrate the ngResource module into my application. Prior to this, everything was functioning smoothly.
This is how I set up my app:
var app = angular.module('app', [ 'ngResource', 'ngRoute' ]);
Then, I configured it as follows:
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'
});
}
]);
However, upon implementation, I encountered the following error message:
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 an exception. The provided error message should offer more insights.
As mentioned in the error message, line 14 refers to:
$resourceProvider.defaults.stripTrailingSlashes = false;
The angular-resource.js file is indeed loaded before app.js.
I am puzzled as I followed the instructions from the Angular Documentation exactly as stated :(
I apologize if this question seems trivial and the solution is staring me in the face because I am unable to spot where I went wrong!
Your help would be greatly appreciated!
Bastien