I'm comparing a number of fields in an Angular 2 template and it works for same case properties but returns false for the same string on different cases. Is there a way to make it case insensitive perhaps through a simple pipe?
<div *ngIf="query?.firstName == address.foreName"></div>
You should use === with toLowercase()
<div *ngIf="query?.firstName.toLowerCase() === address.foreName.toLowerCase()"></div>
Use Angular pipe.
<div *ngIf="(query?.firstName | lowercase) === (address.foreName | lowercase)"></div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With