could get mask value only in html file

1 Answer 76 Views
MaskedTextBox
vamaw
Top achievements
Rank 1
Iron
Iron
vamaw asked on 18 Jun 2021, 03:29 PM

Hi,

 

Could i make all validation like Mask only in HTML File ?

Like this ?


@Component({
selector: "my-app11b",
template: `
<form #templateForm11b="ngForm" novalidate>
<p>Enter valid postcode (A9 9AA)</p>
<kendo-maskedtextbox
name="value1"
[(ngModel)]="value10b"
[mask]="A9 9AA"
[maskValidation]="true"
></kendo-maskedtextbox>
<button [disabled]="!templateForm11b.valid" type="submit" class="k-button">
Submit
</button>
</form>
`,
})
export class AppComponent11b {
public value10b = "M1 1AE"; //only data
}

 

Regards

 

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 23 Jun 2021, 09:52 AM

Hi Vamaw,

Thank you for the shared code snippet.

The developer can set the mask property of the MaskedTextBox component in HTM, passing a string to the mask (without using square brackets):

<kendo-maskedtextbox
                    name="value1"
                    [(ngModel)]="value10b"
                    mask="A9 9AA"
                    [maskValidation]="true"
></kendo-maskedtextbox>

or double-quoted value when using square brackets. 

<kendo-maskedtextbox
                    name="value1"
                    [(ngModel)]="value10b"
                    [mask]="'A9 9AA'"
                    [maskValidation]="true"
></kendo-maskedtextbox>

For more details please check this article from Angular's documentation:

https://angular.io/guide/property-binding#binding-to-a-property

Regards,
Martin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
MaskedTextBox
Asked by
vamaw
Top achievements
Rank 1
Iron
Iron
Answers by
Martin
Telerik team
Share this question
or