Здесь я пытаюсь проверить пин-код 6 di git, используя Angular -8, но он не работает должным образом. Я объясняю мой код ниже.
<div class="col-sm-6">
<mat-card-content>
<mat-form-field appearance="outline">
<mat-label>
Billing PinCode
</mat-label>
<input matInput placeholder="Ex-654321" required formControlName="BillingPinCode" #BillingPinCode maxLength="6" pattern="pinPattern">
</mat-form-field>
</mat-card-content>
</div>
<div *ngIf="customerForm.get('BillingAddresses').get('BillingPinCode').invalid && (customerForm.get('BillingAddresses').get('BillingPinCode').dirty || customerForm.get('BillingAddresses').get('BillingPinCode').touched)"
class="alert alert-danger">
<div *ngIf="customerForm.get('BillingAddresses').get('BillingPinCode').errors.required">
PIncode is required.
</div>
</div>
<div *ngIf="customerForm.get('BillingAddresses').get('BillingPinCode').invalid && (customerForm.get('BillingAddresses').get('BillingPinCode').dirty || customerForm.get('BillingAddresses').get('BillingPinCode').touched)"
class="alert alert-danger">
<div *ngIf="customerForm.get('BillingAddresses').get('BillingPinCode').errors?.pattern">
Invalid Pincode
</div>
</div>
pinPattern: any ='^(\d{6}(-\d{4})?|[A-Z]\d[A-Z] *\d[A-Z]\d)$';
Здесь Моя проблема после ввода 6-го числа также показывает сообщение об ошибке pincode invalid
. Здесь мне нужно подтвердить пин-код, который должен быть 6di git и только цифры.