如何使Div标签在Angular中感动

时间:2018-12-06 09:17:19

标签: angularjs

我在Angular中有一个代码,在这里我对“模糊”操作进行验证。 如果在文本框上未执行任何操作,则验证将不会运行。 我想将此文本框设置为.Touched,以便它将出现在验证中。  我的Div代码如下所示。如何在此处添加.Touched属性?

 <div class="form-group head2" ng-show="workflowlevel<3">
            <label for="appAmt" class="col-md-12 col-sm-12 labels">Approved Amount: </label>
            <input ng-disabled="rejectedOrMoreInfo || isviewmode" type="text" class=" col-md-6 col-lg-6 col-sm-6 col-xs-6" id="approvedAmt"
                ng-model="$parent.appAmt"  ng-blur="validate($parent.appAmt);" name="appAmt" ng-pattern="/^-?[0-9][^\e]*$/" required>
            <span class="error col-md-12 col-sm-12" ng-show="myForm.raiseFundRequest1.appAmt.$touched && myForm.raiseFundRequest1.appAmt.$invalid">This field cannot be blank.</span>
            <span class="error col-md-12 col-sm-12" ng-show="myForm.raiseFundRequest1.appAmt.$dirty &&myForm.raiseFundRequest1.appAmt.$invalid">This is not a valid amount. Please enter valid amount.</span>
            <span class="error col-md-12 col-sm-12" ng-show="isMoreThanRqstAmount">Approved amount should be less than or equal to requested amount</span>
            <span class="error col-md-12 col-sm-12" ng-show="isApprovedAmountZero&&!rejectedOrMoreInfo">Approved amount cannot be zero or lesser. </span>
        </div>

0 个答案:

没有答案