I am using replace operator in angular but i am getting below error, can anyone please let me know what was the issue.
https://stackblitz.com/edit/angular-idantm?file=app%2Fhello.component.ts
You need to create a custom pipe named replace since Angular does not have a pipe in build
import {Pipe} from "@angular/core";
@Pipe({name: "replace"}) export default class {
transform(value: string, replacements: {[key: string]: {}}): string {
return Object
.entries(replacements)
.reduce((result, [key, value]) => result.replace("{{" + key + "}}", value), value);
}
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments