One of my controllers has the code below:
$scope.artistId = $cookies.artistId;
$scope.artistName = $cookies.artistName;
$scope.switchArtist = function(artist) {
$scope.artistName = '';
$scope.artistId = '';
$scope.artist = artist;
$cookies.artistName = artist.name;
$cookies.artistId = artist.id;
$scope.artistName = artist.name;
$scope.artistId = artist.id;
$rootScope.$broadcast(ARTIST_EVENTS.switchedArtist);
};
My view contains:
{{ artistName }}
Although triggering the $scope.switchArtist(); function works, the value of $scope.artistName disappears from my view when I refresh the page.
[edit]
I am currently using angularjs 1.3.14