Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70429

Button background doesn't change even forced by change detector

$
0
0

@Helsing001 wrote:

I’m using Ionic 4.

Ionic Framework : @ionic/angular 4.11.10

I have this issue on Android devices.
I have this ngClass directive on an ion-button:

[ngClass]="{'action-btn' : true, 'action-btn-added' : checkBan(item), 'action-btn-not-added' : !checkBan(item)}"

action-button-added has a color for the --background property, action-button-not-added a different color for the same property.
Even after change detector is triggered manually, the background color of the button doesn’t update.
Inside the button there is an icon and the classes also change the icon’s color. That works without any issues, without even triggering change detector.

Even weirder, if I immediately click anywhere on the screen after the change, the background color doesn’t change. But if I click after some seconds, it will force the change.

It’s not because of any async behavior, as the icon changes its color immediately and it’s the same class.

As a workaround, instead of ngClass I duplicated the button with a ngIf directive and this way everything works.

I’m not sure if it’s a bug and if yes, not sure if here is the place to mention it.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70429

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>