I am running into a weird issue while trying to set the title of the page using the name of the current state (via ui-router).
Actually, the issue is not with settin
I have a similar situation like yours and I do it like the following. You can put that in your main app run block like following. I had
angular.module('myApp').run([
'$log', '$rootScope', '$window', '$state', '$location',
function($log, $rootScope, $window, $state, $location) {
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
if (toState.title) {
$rootScope.pageTitle = toState.title;
}
});
$rootScope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams) {
// something else
});
$state.go('home');
}
]);
and in the html head i have
....
hope this works for you.
PS: Please consult https://docs.angularjs.org/guide/module for details.