formly-js / angular-formly

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

Set error and 'has-error' after form submitting. #678

Open Luddinus opened 8 years ago

Luddinus commented 8 years ago

Hi.

Imagine I have a form where I insert a movie title.

I receive from the response this error JSON e.g:

{
   "errors": {
      "title": "The title must have between 4-32 characters"
   }
}

I see that there is a wrapper "bootstrapHasError", and I would like to insert the error message in the form and set active the 'has-error' class.

The wrapper is this but I dont know how to change things.

<div class="form-group" ng-class="{'has-error': showError}">
  <formly-transclude></formly-transclude>
</div>

What am I missing?

Thx.