Fabio Colombini
Fabio Colombini

Reputation: 132

Disable a button inside ion-nav-buttons

How can I disable a button inside ion-nav-buttons depending on an action in the ion-content?

example: if I click in a button inside ion-content the button inside ion-nav-buttons get disabled.

As I see, I can´t controll the elements inside ion-nav-buttons from the controller of the template that has the ion-nav-buttons.

Upvotes: 0

Views: 1846

Answers (1)

rashidnk
rashidnk

Reputation: 4292

This can be done with ng-disabled in button

Check this Try ng-disabled

<ion-view>
    <ion-nav-buttons side="primary">
      <button class="button" ng-disabled="disabled" ng-click="doSomething()">
        I'm a button on the primary of the navbar!
      </button>
    </ion-nav-buttons>
    <ion-content>
      <button class="button" ng-click="disable()">
        Click to disable
      </button>
    </ion-content>
</ion-view>

//Angular code

$scope.disable=function(){

  $scope.disabled=true;

}

Upvotes: 3

Related Questions