Edit: I want to basically extend the pipe provided by ngx-translate, as below:
import { Pipe, PipeTransform } from '@angular/core';
import { TranslatePipe } from "@ngx-translate/core";
@Pipe({
name: 'msg'
})
export class MsgPipe extends TranslatePipe implements PipeTransform {
transform(value: any, args: any[]): any {
return super.transform(value, args)
}
}
This works only when pure is set to false, so I think the loader for ngx-translate is not ready yet. Is there anyway of checking? This way I could keep the pipe pure and working.
Original post (not relevant):
I have created a pipe that simply calls translateService.instant and returns the result.
@Pipe({
name: 'msg',
pure: false
})
export class MsgPipe implements PipeTransform {
constructor(private translateService: TranslateService) {}
transform(value: any, args: any[]): any {
console.log('checked. val = ', value)
return this.translateService.instant(value, args);
}
}
Without marking this as pure: false, the pipe just returns the value. With it it does (as I presume the file loader is finished).
My issue is that each pipe is called about 8 times, can I do anything with change detection to tell the pipe to stop checking once a value is retrieved?