Ionic - How to change button colour when it is being click


#1

I would like to show a status bar below of my button to show if the button is currently active or in-active. It will be showing Status: In-active and then when i click on the button it will become Status: Active.

html

<ion-view title="Single Projector Room" id="page9">

<ion-nav-buttons side="left">
    <button class="button back-button buttons button-clear header-item" ng-click="goBack()">
      <i class="icon ion-ios-arrow-back"> Back</i> 
    </button>
  </ion-nav-buttons>

  <ion-content padding="true" style="background: url(img/EDD79InSMCeYeMOSchjm_remote.jpg) no-repeat center;background-size:cover;" class="has-header">

  <div class="row">
    <div class="col"><br><br><br><br></div>
  </div>

  <div class="row">
  <div class="col col-offset-5 col-30 text-center"><h4 style="color: #FFFFFF;">Single Projector Control</h4></div>
  <div class="col col-30 text-center"><h4 style="color: #FFFFFF;">Screen Control</h4></div>
  </div>

  <div class="row">
    <div class="col col-offset-5 col-30 text-center"><button class="button button-balanced button-large icon-right ion-power" ng-click="toggleButtonState()" ng-if="buttonState=true; button-stable">On</button></div>
    <div class="col col-30 text-center"><button class="button button-dark button-large icon-right ion-arrow-up-c">Up</button></div>
  </div>

  <div class="row">
    <div class="col col-offset-5 col-30 text-center"><button class="button button-assertive button-large icon-right ion-android-cancel" ng-click="toggleButtonState()" ng-if="buttonState=true; button-stable">Off</button></div>
    <div class="col col-30 text-center"><button class="button button-dark button-large icon-right ion-arrow-down-c">Down</button></div>
  </div>

  <div class="row">
    <div class="col"><br><br></div>
  </div>

  <div class="row">
  <div class="col col-offset-5 col-30 text-center"><h4 style="color: #FFFFFF;">Mic Control</h4></div>
  </div>

  <div class="row">
    <div class="col col-offset-5 col-30 text-center"><button class="button button-balanced button-large icon-right ion-power">On</button></div>
  </div>

  <div class="row">
    <div class="col col-offset-5 col-30 text-center"><button class="button button-assertive button-large icon-right ion-android-cancel">Off</button></div>
  </div>
</div>

  </ion-content>
</ion-view>

controller.js

.controller('singleProjectorRoomCtrl', ['$scope', '$stateParams', function($scope, $stateParams) {

$scope.buttonState = false;


function toggleButtonState ()
{
    if ($scope.buttonState == false)
    {
        $scope.buttonState = true;
    }
    else
    { 
       $scope.buttonState = false;
    }  
};

$scope.goBack = function() {
window.history.back();
}

}])