0

我是 AngularJS 的新手。

在下面的小提琴中,当用户单击“此提交触发验证。但我想将此按钮放在页面末尾”按钮时。我可以看到警报/错误,但我想显示一条自定义消息,我正在努力做到这一点。

Header inputs:
    <input type="name" ng-model="sample" required/>
    <input type="name" ng-model="sampleX" required/>

    <input type="submit" value="This submit triggers validation. But I wanted to put this button at the end of the page"/>
</form>

<hr/>

Some other form here. Think line items

<hr />
<a class="btn" ng-click="triggerSubmit()">Wanted this submit to trigger the validation to the form on which this button doesn't belong, e.g. trigger to header</a>

js小提琴链接 http://jsfiddle.net/unWF3/6/

谢谢,
卡利安巴萨

4

1 回答 1

2

要禁用本机浏览器验证,请将novalidate属性添加到表单元素:

    <form novalidate submit-on="myEvent" ng-submit="onSubmitted()">
于 2013-03-20T13:26:57.600 回答