I have a pipe I applied to my form input because I want "visually" separate decimals with ",", but internally with "."
Sometimes I need to set values programmatically and in this case the change is not detected even setting my pipe as impure
pipe
@Pipe({
name: 'decimalSeparator',
pure: false
})
export class DecimalPipe implements PipeTransform {
transform(value: string): string {
return value ? value.replace('.',',') : '';
}
}
html template
<form [formGroup]="formGroup">
<input nxInput value="{{ formGroup.get('pipeInput').value | decimalSeparator }}" formControlName="pipeInput"/>
</form>
typescript
setValue() {
this.formGroup.get('pipeInput').setValue("100.2"); // Pipe not fired here
}