Doc
Doc

Reputation: 5276

How to escape mask rules in kendo maskedtextbox for angular2?

I need to build a mask where some charachters are fixed, like a number where the user have to specify last three digits.

How can I escape the "0" default mask behaviour?

the docs says to use backslash character, but I can't figure out how it should works.

example: my mask needs to show the number 12000___ and user have to enter last 3 digits

html:

<kendo-maskedtextbox [mask]="mask"></kendo-maskedtextbox>

ts:

mask = "12\0\0\0000";

but it doesn't compile...

Upvotes: 0

Views: 730

Answers (1)

Philipp
Philipp

Reputation: 1884

A backslash is a escape character in (JavaScript) strings, thus you need to escape the backslash.

Like this: mask = "12\\0\\0\\0000"

I've also prepared a Plunkr.

Upvotes: 1

Related Questions