Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 90ac8d5

Browse files
committed
fix(docs): update page title only when content loads
1 parent 6eb1179 commit 90ac8d5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docs/src/templates/docs.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ function DocsController($location, $browser, $window, $cookies) {
1212
scope.version = angular.version.full + " " + angular.version.codeName;
1313
scope.subpage = false;
1414
scope.offlineEnabled = ($cookies[OFFLINE_COOKIE_NAME] == angular.version.full);
15+
scope.futurePartialTitle = null;
1516

1617
if (!$location.path() || INDEX_PATH.test($location.path())) {
1718
$location.path('/api').replace();
@@ -28,7 +29,9 @@ function DocsController($location, $browser, $window, $cookies) {
2829
var i = scope.pages.length;
2930
while (i--) {
3031
if (scope.pages[i].id == scope.partialId) {
31-
scope.partialTitle = scope.pages[i].name;
32+
// TODO(i): this is not ideal but better than updating the title before a partial arrives,
33+
// which results in the old partial being displayed with the new title
34+
scope.futurePartialTitle = scope.pages[i].name;
3235
break;
3336
}
3437
}
@@ -66,6 +69,7 @@ function DocsController($location, $browser, $window, $cookies) {
6669
};
6770

6871
scope.afterPartialLoaded = function() {
72+
scope.partialTitle = scope.futurePartialTitle;
6973
SyntaxHighlighter.highlight();
7074
$window.scrollTo(0,0);
7175
$window._gaq.push(['_trackPageview', $location.path()]);

0 commit comments

Comments
 (0)