frontend: update the page title when navigate

This commit is contained in:
nemunaire 2019-01-21 00:35:07 +01:00
commit 525b3d6b56
2 changed files with 14 additions and 1 deletions

View file

@ -414,8 +414,21 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
if (exercicesUrl != undefined)
$rootScope.current_exercice = exercicesUrl[$routeParams.theme + "/" + $routeParams.exercice];
})
$scope.$watchGroup(["themes", "current_theme", "current_exercice"], function(newValues) {
var themes = newValues[0];
var current_theme = newValues[1];
var current_exercice = newValues[2];
if (themes != undefined && themes[current_theme] != undefined && themes[current_theme].exercices != undefined && themes[current_theme].exercices[current_exercice] != undefined)
$rootScope.title = themes[current_theme].name + " > " + themes[current_theme].exercices[current_exercice].title;
});
} else {
$rootScope.current_exercice = 0;
$scope.$watchGroup(["themes", "current_theme"], function(newValues) {
var themes = newValues[0];
var current_theme = newValues[1];
if (themes != undefined && themes[current_theme] != undefined)
$rootScope.title = themes[current_theme].name;
});
}
var cbh;