Form validation on ng-click angularjs

后端 未结 2 1864
独厮守ぢ
独厮守ぢ 2020-12-14 16:05

I am unable to find a solution in the existing answers, hence i am posting this.

I have a form which has many input fields, many of them are required.

There

2条回答
  •  忘掉有多难
    2020-12-14 16:46

    A very-very simple solution is to give the form a name so you can refer to it and then tweak the ng-click to fire only if the form is valid:

    Forked fiddle: https://jsfiddle.net/r8d1uq0L/

    I like separating validation (a business concern) from the view, to that end I created egkyron that lets you define the model constraints in code and use programmatic validation along with standard Angular form validation.

提交回复
热议问题