The soon in section is not updated because the way you are retrieving the selected city from the service is wrong, at the point of assignin the city to your $scope
, nothing is selected, change your start.nav
bar controller to:
controller: ["$scope", "CityService", function ($scope, CityService) {
$scope.$watch(CityService.getCity,function(v){
$scope.data = {city : v}
},true);
and it will work, see fork.
EDIT:
Which controller do you expect to see executed again? start.nav
? That one isn't called again because you are never really moving out of it, all the states you go to after your app runs are children of start.nav
. The way you retrieve the selected city is wrong because that line of code only runs once, and at that point nothing is assigned to city
in your service.