This repository was archived by the owner on Jan 6, 2025. It is now read-only.
This repository was archived by the owner on Jan 6, 2025. It is now read-only.
ngClass gets overwritten by ngClass.xs #832
Open
Description
Hi,
So it's my first time making a responsive app with flex layout, and still trying to figure things out, since it's different than the old school bootstrap grids I'm used to.
And I have a problem regarding the consistency of classes when going to mobile ngClass.xs removes my ngClass ones, my code:
<div [ngClass]="{'class0': condition == true,'class1': condition2 == true}"
ngClass.xs="mobile">
If I have regular class="class0 class1", it's fine the classes are preserved , I also tried, but the class0, is removed if it's not specified in the xs condition
<div
ngClass="class0"
[ngClass.xs]="{'mobile':true}">
</div>
I don't want to have to copy paste code like (this does work):
<div [ngClass]="{'class0': condition == true,'class1': condition2 == true}"
ngClass.xs="{'class0': condition == true,'class1': condition2 == true,'mobile'}">
Can we have a cleaner solution for example:
<div [ngClass]="{'class0': condition == true, 'class1': condition2 == true, 'mobile': xsBoolean}">
Please let me know what you think, or if there is a better way to do this.
Cheers.