mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-26 03:00:25 +00:00
fix(docs): increment load counter only when a valid page is requested
This commit is contained in:
parent
28ed5ba465
commit
4ae671ac88
1 changed files with 6 additions and 7 deletions
|
|
@ -26,20 +26,19 @@ function DocsController($location, $window, $cookies) {
|
|||
scope.sectionId = parts[1];
|
||||
scope.partialId = parts[2] || 'index';
|
||||
scope.pages = angular.Array.filter(NG_PAGES, {section: scope.sectionId});
|
||||
scope.loading++;
|
||||
|
||||
var i = scope.pages.length;
|
||||
while (i--) {
|
||||
if (scope.pages[i].id == scope.partialId) {
|
||||
// TODO(i): this is not ideal but better than updating the title before a partial arrives,
|
||||
// which results in the old partial being displayed with the new title
|
||||
scope.futurePartialTitle = scope.pages[i].name;
|
||||
break;
|
||||
}
|
||||
if (scope.pages[i].id == scope.partialId) break;
|
||||
}
|
||||
if (i<0) {
|
||||
scope.partialTitle = 'Error: Page Not Found!';
|
||||
delete scope.partialId;
|
||||
} else {
|
||||
// TODO(i): this is not ideal but better than updating the title before a partial arrives,
|
||||
// which results in the old partial being displayed with the new title
|
||||
scope.futurePartialTitle = scope.pages[i].name;
|
||||
scope.loading++;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue