How can I make my Ionic Button refresh all ion-views. (Preferable in most just revaluate a ng-switch, in 1 reload EVERYTHING)


#1

in my view I have a ng-switch like:

<div ng-switch on="team.isFavorite">
	<button class="button button-energized snbutton" ng-switch-when="false" ng-click="makeTeamFavorite()">
	  Show team on dashboard
	</button>
	<p class="snmsg" ng-switch-default>
	  This team is shown on the dashboard
	</p>
</div>

How can I make my Ionic Button refresh all ion-views.

Preferable in most just revaluate a ng-switch, in 1 reload EVERYTHING)

##What I tried in my controller:

.controller('List-PeopleCtrl', function($ionicHistory, $state, $scope, $stateParams, Teams) {
  $scope.makeTeamFavorite = function() {
      Teams.setFavoriteId($stateParams.teamId);
      $ionicHistory.clearCache();
      $state.go($state.current);
  }
  $scope.team = Teams.get($stateParams.teamId);
  $scope.team.isFavorite = Teams.getFavoriteId()==$stateParams.teamId;
  $scope.people = Teams.members($stateParams.teamId);
})

it would invalidate all caches I guess but it didn’t work anyway :smiley:

##Note

  • I searched but didn’t find anything to do this…
  • I don’t want to mark my ion view with cache=false and opt out of all caching
  • I think this is ionic specific but it could be my general lack of knowledge concerning angularjs :smiley:
  • the point is it works (without clearing the cache) when I next open the view again … just that it isn’t reloaded while looking at it

— cross posted (because I didn’t figure out how to post here) —