当我混合使用angular和mvc时,mvc模型的验证不起作用。 这是我的型号代码:
[Required(ErrorMessage ="Required")]
public string EmailId { get; set; }
这是我的HTML代码:
<div class="form-group">
@Html.LabelFor(model => model.em.EmailId, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.em.EmailId, new { htmlAttributes = new { @class = "form-control", data_ng_model = "EmailIdem" } })
@Html.ValidationMessageFor(model => model.em.EmailId, "", new { @class = "text-danger" })
</div>
</div>
<input type="button" class="btnAdd" value="Save" data-ng-click="AddEmployee()" />
点击“保存”后,验证无效。