formly-js / angular-formly

JavaScript powered forms for AngularJS
http://docs.angular-formly.com
MIT License
2.23k stars 406 forks source link

field focus #729

Open burhanfarooqws opened 7 years ago

burhanfarooqws commented 7 years ago

Hi, I am new to angular formly so far plugin served the purpose, just little thing that causing issue for me is the focus on error field of input type. I have seen the force focus & expressionProperties but not working for me. I want to focus on field if any of validation fail or validator. here is my field:

{ key: 'otp', type: 'customOTPInput', templateOptions: { type: 'text', placeholder: 'OTP *', required: true, classicon: 'icon-append fa fa-mobile', classsection: 'col-xs-7 col-sm-7 col-md-7 col-lg-7', friendlyname: 'OTP' }, ngModelElAttrs: { 'maxlength': '6', 'minlength': '6', }, validation: { messages: { required: function(viewValue, modelValue, scope) { return scope.to.friendlyname +' is required' }, minlength: function(viewValue, modelValue, scope){ return scope.to.friendlyname +' should be 6 characters' }, maxlength: function(viewValue, modelValue, scope){ return scope.to.friendlyname +' should be 6 characters' } } }, expressionProperties: { 'templateOptions.required': 'model.tncchecked' } }

Thanks