From 4ae671ac88fc1fd74af988a188525e8eaa1c3a4a Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Wed, 26 Oct 2011 16:59:02 -0700 Subject: fix(docs): increment load counter only when a valid page is requested --- docs/src/templates/docs.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'docs/src') diff --git a/docs/src/templates/docs.js b/docs/src/templates/docs.js index f5696050..345bc3d5 100644 --- a/docs/src/templates/docs.js +++ b/docs/src/templates/docs.js @@ -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++; } } }); -- cgit v1.2.3