0

Forum


You need to log in to create posts and topics.

How can I use a PercentPipe in ngForm?

Hi,

I searched for Google for a long time but did not find anything.

In the mat-table I have no problems and it works perfectly.

<ng-container matColumnDef="rateOfTax">
    <mat-header-cell *matHeaderCellDef mat-sort-header> {{'vatRate.RateOfTax' | translate}} </mat-header-cell>
    <mat-cell *matCellDef="let row"> {{row.rateOfTax | percent:'2.2-5'}}</mat-cell>
</ng-container>

but how can I use the pipe in the ngForm?

mat-form-field [floatLabel]="floatLabels" fxFlex>
    <mat-label>{{'vatRate.RateOfTax' | translate}}</mat-label>
    <input matInput formControlName="rateOfTax" [readonly]="!isEditMode" type="number" step ="0.01"/>
    <mat-error *ngIf="rateOfTax.hasError('required')">{{'vatRate.errors.RateOfTaxRequired' | translate}}</mat-error>
</mat-form-field>