Onclick of icon hide the current icon and show other icon at same position, i.e. toggle

So the problem goes like this, onclick of icon1 show table view. On table display, the icon1 gets changed to icon2. On click of icon2 change the div to statistic view and on display of statistics, icon2 is changed to icon1. I am looking for something like toggle of icon as well as display. Can all this be done only on one click using AngularJS and ionic?

Maybe i don’t have undertood the problem, but…if you want change icon on click put similar code on controller
$scope.buttonStyle=“icon ion-ios-time-outline”;
$scope.buttonPress = false;
$scope.BUTTONCLICKED = function() {
$scope.buttonPress = !$scope.buttonPress;
if($scope.buttonPress == true){
$scope.buttonStyle=“icon ion-ios-time”;
}else{
$scope.buttonStyle=“icon ion-ios-time-outline”;
}

then in html
button class=“button button-icon icon {{buttonStyle}}” ng-click="BUTTONCLICKED()"
button

}

For me work fine