Skip to content
This repository was archived by the owner on Apr 30, 2018. It is now read-only.
This repository was archived by the owner on Apr 30, 2018. It is now read-only.

Example of validation on form submit #317

@m0t0r

Description

@m0t0r

Hi, I have been trying to setup angular-formly to show validation messages on form submit but unfortunately I can't figure out.
I try to set a form as following:

<form name="vm.form" ng-submit="vm.save(vm.model)" novalidate>
    <formly-form form="vm.form" model="vm.model" fields="vm.fields">
        <button translate type="submit" class="btn btn-primary">Save</button>
    </formly-form>
 </form>

and then use form reference in ng-messages template:

<script type="text/ng-template" id="error-messages.html">
      <formly-transclude></formly-transclude>
      <div ng-messages="fc.$error" ng-if="form.$submitted || options.formControl.$touched" class="error-messages">
        <div ng-message="{{ ::name }}" ng-repeat="(name, message) in ::options.validation.messages" class="message">{{ message(fc.$viewValue, fc.$modelValue, this)}}</div>
      </div>
    </script>

but form state properties never update.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions