I have the following problem:
I have a two states, defined as follows:
state('home', {
url: '/home',
templateUrl: 'home/Home.html',
controller: 'HomeController as hc'
}).state('home.index', {
url: '/index',
templateUrl: 'index/Index.html',
controller: 'IndexController as ic'
})
In HomeController, I defined value responsible for my title in navbar, which is stored in a service:
this.title = Service.getTitle();
And this is a title in my navbar. When I change state to Index, I set new title:
this.title = Service.updateTitle("Index")
However, this does not change the title of my navbar.
Service has one variable title
, and two functions:
getTitle(){
return this.title;
}
updateTitle(newTitle){
this.title = newTitle;
return;
}
Any ideas on what am I doing wrong?