public typeArray= [
{
id: 'MOTHER',
name: '{{ myApp.type.MOTHER | translate }}'
}];
How can we write to translate while defining an array in a TypeScript file?
You can use your pipes in your components or anywhere you want by importing them. Import your translate pipe to your component, then add it to constructor
constructor(private yourPipe: YourPipe) {}
or you can create a new instance from your pipe class:
public yourPipe: YourPipe = new YourPipe();
Then you can use it like this:
this.yourPipe.transform(value);
transform function will return the transformed value by the pipe.
So in your case:
public typeArray = [
{
id: 'MOTHER',
name: this.yourPipe.transform(myApp.type.MOTHER)
}
];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With