tiaguinho / ionic2-mask-directive

directive to mask ion-input
MIT License
23 stars 11 forks source link

do you know how to change the mask through code? #14

Open raphaelluiz128 opened 6 years ago

raphaelluiz128 commented 6 years ago

i have the html code: <ion-input type="text" style = 'width:80%' [(ngModel)]="user.cpf_cnpj" mask="999.999.999-99">

and ts code

Change_Toggle(bval:any) { if (bval===false) { this.Type = "Pessoa Jurídica"; this.CPF_CNPJ = "CNPJ"; this.user.type_user = "Pessoa Jurídica"; this.user.cpf_cnpj['mask']="00.000.000/0000-00"; } else { this.Type = "Pessoa Física"; this.CPF_CNPJ = "CPF"; this.user.type_user = "Pessoa Física"; this.user.cpf_cnpj['mask']="999.999.999-99"; }

how do I change the input mask?

danilopolani commented 6 years ago

Try with [mask]="yourVariable"