The RequireJS
is not resolving dependency properly when the routes is of multiple levels as in http://www.example.com/profile/view
. If I just have http://www.example.com/view
, the controller dependency is resolved properly.
My bootstrap.js
require.config({
baseUrl : 'res/js',
paths: {
routeResolve: 'routeResolve',
'domReady': 'lib/domReady',
angular: 'lib/angular',
angularRoute: 'lib/angular-route',
angularResource: 'lib/angular-resource',
angularSanitize: 'lib/angular-sanitize',
cssPath : '../css'
},
map: {
'*': {
css: 'lib/require-css/css.min'
}
},
shim: {
'angular': {'exports': 'angular'},
'angularRoute': {deps : ['angular']},
'angularResource': {deps : ['angular']},
'angularSanitize': {deps : ['angular']}
},
priority: ['angular']
});
Folder structure:
-rootdir
- public
- res
- js
- css
When I use this route http://www.example.com/profile/view
, all the dependency modules are resolved with base url as http://www.example.com/profile/res/js/controller.js
, which does not exist in this path http://www.example.com/profile
.
If I change the route to http://www.example.com/view
(just one level), dependencies are resolved with this base url http://www.example.com/res/js/controller.js
There should be a configuration issue which I am missing, but I could not find a solution for this.