Fix handling of promises for title and description of pages in Quay

We were not correctly waiting for the `scope` on page to be filled before trying to calculate the title, and the logic for description was broken as well.
This commit is contained in:
Joseph Schorr 2017-11-08 16:14:14 -05:00
parent 32022c9421
commit 091b937ee3
2 changed files with 23 additions and 17 deletions

View file

@ -103,9 +103,10 @@ export function provideRun($rootScope: QuayRunScope,
// Listen for route changes and update the title and description accordingly.
$rootScope.$on('$routeChangeSuccess', async(event, current, previous) => {
$rootScope.title = metaService.getTitle(current) || defaultTitle;
const title = await metaService.getTitle(current);
const description = await metaService.getDescription(current);
$rootScope.title = title || defaultTitle;
if ($rootScope.description != description) {
$rootScope.description = description;
}