Validate field input

1
0
-1

Hi everybody,

I'm starting with UI designer and I'm trying to make a custom widgets to validate a string, I can not binding field value with variable form.

In the template I have the following settings:
<form name="myForm"
<labelRFC:
<input type="text" name="rfc" ng-model="example.text"
ng-pattern="example.word" required ng-trim="false"
</label
<div role="alert"
<span class="error" ng-show="myForm.rfc.$error.required"
Required!</span
<span class="error" ng-show="myForm.rfc.$error.pattern"
RFC!</span
</div
</form

In the controller:
function ($scope) {
$scope.example = {
word: /^([A-Z,Ñ,&]{3,4}([0-9]{2})(0[1-9]|1[0-2])(0[1-9]|1[0-9]|2[0-9]|3[0-1])[A-Z|\d]{3})$/
};
}

Variable form:
formInput {"reportContract": { "RFC": ""}} JSON

Value:
formInput.reportContract.rfc

If anyone has an example or an idea.
Thanks

No answers yet.
Notifications