Ionic-framework: showWhen/hideWhen not working Beta 6

Created on 21 Apr 2016  路  2Comments  路  Source: ionic-team/ionic-framework

showWhen/hideWhen is not working.

showwhen

`

<ion-buttons left>
    <button showWhen="android" (click)="onCancel()" >
      <ion-icon name="close"></ion-icon>
    </button>
    <button showWhen="ios" (click)="onCancel()" >Cancel</button>
  </ion-buttons>

  <ion-title>Add Location</ion-title>

 <ion-buttons end>
    <button showWhen="android" (click)="onSubmit()" >
      <ion-icon name="checkmark"></ion-icon>
    </button>
    <button showWhen="ios" (click)="onSubmit()" >Done</button>
</ion-buttons>


</ion-navbar>

`

Version 2 Beta 6

Cordova CLI: 6.0.0
Gulp version: CLI version 3.9.0
Gulp local: Local version 3.9.1
Ionic Framework Version: 2.0.0-beta.6
Ionic CLI Version: 2.0.0-beta.25
Ionic App Lib Version: 2.0.0-beta.15
ios-deploy version: 1.8.6
ios-sim version: 5.0.6
OS: Mac OS X El Capitan
Node Version: v5.1.0
Xcode version: Xcode 7.3 Build version 7D175

Most helpful comment

So I looked into this some more, and it is because the button's display property is taking precedence over the showWhen/hideWhen classes. As a temporary fix, you should be able to add the following css to your app.core.scss file (or any other sass file that comes after the ionic imports):

// Applied by the showWhen directive
.hidden-show-when {
  display: none !important;
}

// Applied by the hideWhen directive
.hidden-hide-when {
  display: none !important;
}

I'll work on fixing this in the framework. Thanks for the issue!

All 2 comments

So I looked into this some more, and it is because the button's display property is taking precedence over the showWhen/hideWhen classes. As a temporary fix, you should be able to add the following css to your app.core.scss file (or any other sass file that comes after the ionic imports):

// Applied by the showWhen directive
.hidden-show-when {
  display: none !important;
}

// Applied by the hideWhen directive
.hidden-hide-when {
  display: none !important;
}

I'll work on fixing this in the framework. Thanks for the issue!

Thanks once again Brandy, you're awesome!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexbainbridge picture alexbainbridge  路  3Comments

SebastianGiro picture SebastianGiro  路  3Comments

giammaleoni picture giammaleoni  路  3Comments

MrBokeh picture MrBokeh  路  3Comments

aslamj picture aslamj  路  3Comments