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
The selected answer has the following issues:
i would suggest the following code instead
transform(value: string, args: string): any {
if (args && value) {
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;
}