IE11 and String.prototype.includes() in Angular directives
Just come across an interesting behaviour with Angular directives and E11. Apparently E11 does not seem to work with the function String.prototype.includes(), for example:
<div ng-if="str.includes(‘test’)" class="someClass"><span>Some text</span></div>
where str == ‘Sometest‘ and the generic syntax is as below:
Browser’s compatibility is an issue with IE11 and generally speaking it is poor across IE, so it is highly recommended to use this, instead:
<div ng-if="str.indexOf(‘test’) >= 0" class="someClass"><span>Some text</span></div>
as per the syntax below:
IndexOf method returns the index of the string as passed in. If the value is not found, it returns -1.