Ionic3 - Can't bind to 'textMask' since it isn't a known property of 'ion-input'
10,824
If you have existing home.module.ts or contact-page.module.ts (based on the image), do the importing of TextMaskModule to them and not in the app.module.ts
Related videos on Youtube
Author by
Admin
Updated on June 04, 2022Comments
-
Admin almost 2 years
I am trying to use textMask on ionic 3, but it's not working I am getting error message (Can't bind to 'textMask' since it isn't a known property of 'ion-input') . I am following Joshmorony's tutorial https://www.joshmorony.com/improve-mobile-form-ux-with-input-masks/
Click here to see the error message
app.module.ts import { TextMaskModule } from 'angular2-text-mask'; @NgModule({ imports: [ FormsModule, TextMaskModule ], contact.html <ion-input type="tel" [(ngModel)]="phoneNumber" [textMask]="{mask: masks.phoneNumber}" > </ion-input> contact.ts import { TextMaskModule } from 'angular2-text-mask'; export class ContactPage { form: FormGroup; masks: any; phoneNumber: any = ""; constructor() { this.masks = { phoneNumber: ['(', /[1-9]/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/], }; } }
-
Admin almost 6 yearsI imported TextMaskModule in the contact-page.module.ts and it works fine. Thanks for your help.