I have a site with multiple angularjs app inside. The structure is the following :
index.html
js
js_controller.js
js_directives.js
js_filters.js
js_routes.js
js_home.js
sub_app
index.html
js
subapp_controller.js
subapp_directives.js
subapp_filters.js
subapp_routes.js
subapp_home.js
On the first app I added the following in js_routes.js :
angular.module('jsroutes.routes', ['ngRoute'])
.config(['$routeProvider', function ($routeProvider) {
$routeProvider.when('/', {templateUrl: 'templates/mytemplates.html'});
$routeProvider.otherwise({redirectTo: '/'});
}])
No problem with this. It works well. The problem concern my subapp. I added the following in subapp_routes.js :
angular.module('subapproutes.routes', ['ngRoute'])
.config(['$routeProvider','$locationProvider', '$httpProvider', function ($routeProvider, $locationProvider, $httpProvider) {
$routeProvider.when('/subapp', {templateUrl: '/subapp/templates/mytemplate.html', controller: 'myCtrl'});
$routeProvider.when('/subapp/:id', {templateUrl: '/subapp/templates/mysecond.html', controller: 'myCtrl'});
$routeProvider.otherwise({redirectTo: '/subapp'});
}])
The problem is : if the url is /subapp works, /subapp/1 not work for example. It returns to home with templates/mytemplates.html
I don't know why.
If someone can help me. Thanks in advance