From 90ac8d57b0d5ef68cb70486edf0590fff225a284 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Fri, 21 Oct 2011 07:56:44 -0700 Subject: fix(docs): update page title only when content loads --- docs/src/templates/docs.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'docs/src') diff --git a/docs/src/templates/docs.js b/docs/src/templates/docs.js index 4a8607cf..40e05586 100644 --- a/docs/src/templates/docs.js +++ b/docs/src/templates/docs.js @@ -12,6 +12,7 @@ function DocsController($location, $browser, $window, $cookies) { scope.version = angular.version.full + " " + angular.version.codeName; scope.subpage = false; scope.offlineEnabled = ($cookies[OFFLINE_COOKIE_NAME] == angular.version.full); + scope.futurePartialTitle = null; if (!$location.path() || INDEX_PATH.test($location.path())) { $location.path('/api').replace(); @@ -28,7 +29,9 @@ function DocsController($location, $browser, $window, $cookies) { var i = scope.pages.length; while (i--) { if (scope.pages[i].id == scope.partialId) { - scope.partialTitle = scope.pages[i].name; + // 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; } } @@ -66,6 +69,7 @@ function DocsController($location, $browser, $window, $cookies) { }; scope.afterPartialLoaded = function() { + scope.partialTitle = scope.futurePartialTitle; SyntaxHighlighter.highlight(); $window.scrollTo(0,0); $window._gaq.push(['_trackPageview', $location.path()]); -- cgit v1.2.3