A messenger displays the search results based on the input given by the user. Need to highlight the word that is been searched, while displaying the result. These are the h
To expand on Kamal's answer,
The value coming into the transform method, could be a number, perhaps a cast to string String(value)
would be safe thing to do.
transform(value: string, args: string): any {
if (args && value) {
value = String(value); // make sure its a string
let startIndex = value.toLowerCase().indexOf(args.toLowerCase());
if (startIndex != -1) {
let endLength = args.length;
let matchingString = value.substr(startIndex, endLength);
return value.replace(matchingString, "" + matchingString + "");
}
}
return value;
}