Use below code to dynamically set page title depending on your state or route:
in app.js
...
...
.state('signup', {
url: "/signup",
controller: 'SignUpCtrl',
templateUrl: 'views/signup/signUp.html',
pageTitle: 'SignUp'
});
...
app.run(function($rootScope, $state) {
$rootScope.$on('$stateChangeStart', function(event, current) {
$rootScope.pageTitle = current.pageTitle;
})
});
in html:
in app.js
...
...
.state('signup', {
url: "/signup",
controller: 'SignUpCtrl',
templateUrl: 'views/signup/signUp.html',
pageTitle: 'SignUp'
});
...
app.run(function($rootScope, $state) {
$rootScope.$on('$stateChangeStart', function(event, current) {
$rootScope.pageTitle = current.pageTitle;
})
});
in html:
<html ng-app="app">
<head>
<title>{{ pageTitle }}</title>
...
Happy to help, cheers !!
ReplyDelete