I have a controller I'm using for 3 different views that collects data. I'm watching 2 scopes in it. This is an excerpt:
// predefine place before Google Maps API GET
$scope.place = {
formatted_address: '',
url: ''
};
// watch place in case of change (doesn't work otherwise)
$scope.$watch('place', function () {
$scope.poll.Poll.Location = $scope.place.formatted_address;
$scope.poll.Poll.UrlLocation = $scope.place.url;
});
Everything works fine on view 1, the $scope.poll.Poll.Location
and the $scope.poll.Poll.Location
gets filled with data of the Google Maps api.
But when I click on a button which changes my route (ui-sref="view2")
, which is using the same controller, the scopes are empty.
How can I transfer the watched scopes between multiple views with the same controller?