How can I use an ng-if condition to look for a specific character ?

ng-if="select.name == '?'" 

Solution : ES2015 have String#includes method that checks whether a string contains another. This can be used if the target environment supports it. The method returns true if the needle is found in haystack else returns false.

ng-if="myString.includes(string/char)"
***Or***
*ngIf="myString.includes(string/char)"

Here, string/char is the string that is to be searched in myString.

Tagged:

Laisser un commentaire