I have an Angular app, which has several ng-controllers and several templates. And here is a snippet of my routing:
when('/claims', {
templateUrl: '/angular_templates/index',
controller: 'ClaimsController',
resolve: {
rootClaims: ['claimsCache', function (claimsCache) {
return claimsCache.getResource(0);
}]
}
}).when('/claims/:id', {
templateUrl: '/angular_templates/show',
controller: 'ClaimController',
resolve: {
claim: ['$http', '$route', function ($http, $route) {
return $http.get('/claims/' + $route.current.params.id + '.json').then(
function (response) {
return response.data;
},
function (response) {
console.log(response.status);
return {};
}
);
}]
}
}).when('/tags/:id/claims_with_tag', {
templateUrl: '/angular_templates/tag_claim.html',
controller: 'TagController',
resolve: {
tag: ['$http', function ($http) {
return $http.get('claims_with_tag.json').then(
function (response) {
return response.data;
},
function (response) {
console.log(response.status);
return {};
}
);
}]
}
});
When I open several pages one by one by manually entering the URL and pressing Enter, and then press browser's back button - everything works well. But when I navigate from one page to another by clicking some links on the pages and then use the Back button, I can see in console that all the data is loaded, queries are sent to the server, but no ng-content actually displays on the page. After page refresh all loads fine.
I have noticed one more peculiarity - the back navigation doesn't work for that page only which was opened first. For example, I manually enter the address of the page1, then go to page2, page3, and then click the Back button in browser - all works until we reach the very first page (page1 in this sample). When getting to page1, I can see the data coming from the server in the console, but it doesn't display on the page.
Does anyone know a solution for this issue?