Reputation: 569
I'm using observables to get each letter from an input type text in the same moment and show child component based on conditions (the restaurant name should include same letters entered in the text input). I can't figure a way to do it in the ts file , but it works absolutely fine on this code:
<div *ngFor="let res of restaurants">
<li
*ngIf="(res.Name.includes(searchString) || searchLength == false) &&(res.Address == printedOption || checked == false)"
class="nav-item has-treeview menu-open">
<a class="nav-link active">
<app-res-tabs [res]="res"></app-res-tabs>
</a>
</li>
</div>
the problem is that I need it to be not case sensitive.
(Above code works fine for Xres
and Xres
, but doesn't for xres
and Xres
for example).
How to make that work?
Upvotes: 1
Views: 953
Reputation: 9
You could use the Angular tolowercase Pipe
*ngIf="((res.Name|lowercase).includes(searchString|lowercase) || searchLength == false) &&(res.Address == printedOption || checked == false)"
Upvotes: 0
Reputation: 22213
Try:
*ngIf="(res.Name?.toLowerCase().includes(searchString?.toLowerCase()) || searchLength == false)
Upvotes: 2