This is probably very much a newbie question -- but i can't figure it out.
I have an input text with minlegth
9, and I have to do something like this:
If the user types only one number, I have to add some "0"
before this number to reach value.length == 9
Example:
123 => 000000123
I'm using Angular 2 input forms and a pipe to transform the result.
Can anyone help?
Here i've found the solution:
transform(val) {
var standardLength = "000000000";
return (standardLength + val).slice(-standardLength.length);
}
Thanks to everyone!