0

我正在为我的一个项目制作大型表格。

这就是我设计表单的方式

@Html.EditorFor(model => model.EmployeeMaster.EMP_FirstName, new { htmlAttributes = new { @class = "form-control", required = "required", @ng_model = "EmployeeMaster.EMP_FirstName", @ng_change = "setFullName()", ng_minlength="3" } })

<span ng-show="EmployeeMaster.EMP_FirstName.$touched && EmployeeMaster.EMP_FirstName.$invalid">The name is required.</span>
<p ng-show="employeeForm.EmployeeMaster.EMP_FirstName.$error.minlength">Username is too short.</p>    
<ng-show="employeeForm.EMP_FirstName.$error.minlength">1. Username is too short.</p>

我试图用上述选项验证它们,但它们都不起作用,我可以知道可能是什么原因吗?

更新

这是 html 的生成方式。

<input class="form-control text-box single-line ng-dirty ng-valid-parse ng-not-empty ng-valid-required ng-valid ng-valid-minlength ng-touched" id="EmployeeMaster_EMP_FirstName" name="EmployeeMaster.EMP_FirstName" ng-change="setFullName()" ng-minlength="3" ng-model="EmployeeMaster.EMP_FirstName" required="required" type="text" value="">

<span ng-show="EmployeeMaster.EMP_FirstName.$touched &amp;&amp; EmployeeMaster.EMP_FirstName.$invalid" class="ng-hide">The name is required.</span>
<p ng-show="employeeForm.EmployeeMaster.EMP_FirstName.$error.minlength" class="ng-hide">Username is too short.</p>
<p ng-show="employeeForm.EMP_FirstName.$error.minlength" class="ng-hide">1. Username is too short.</p>
4

0 回答 0