javascript - Can not display the error message using Angular.js -


i have issue. not display error message while input field takes invalid data using angular.js. explaining code below.\

<form name="billdata" id="billdata"  enctype="multipart/form-data" novalidate>    <div ng-class="{ 'myerror': billdata.type.$touched && bill data.type.$invalid }">        <input type="number"  class="form-control oditek-form"  ng-model="type" name="type" step="1" min="0" placeholder="add type" ng-pattern="/^[0-9]+([,.][0-9]+)?$/">    </div>    <div class="help-block" ng-messages="billdata.type.$error" ng-if="billdata.type.$touched">        <p ng-message="pattern" style="color:#f00;">this field needs number(e.g-0,1..9).</p>    </div> </form>  

here need give number input .if user entering rather number should display error message.here myerror showing red color border on input field coming message not coming should display. please me.

    <html>      <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>      <div ng-app="">      <form name="myform">          text  <input name="myname" ng-model="myname"  ng-pattern="/^[a-za-z ]+$/" required>             <span style="color: red" ng-show="myform.myname.$error.required">first name required.</span>                                                                        <span style="color: red" ng-show="myform.myname.$error.pattern">any other symbol not allow.</span>              <br />        number                 <input type="number" class="textbox_usr" name="txtmobno" id="txtmobno"  ng-model="txtmobno" ng-minlength="10" ng-maxlength="10" required /><br />                                                              <span style="color:red" ng-show="myform.txtmobno.$dirty && myform.txtmobno.$invalid">                                                                  <span ng-show="myform.txtmobno.$error.required || myform.txtmobno.$error.number">valid mobile number required</span>                                                                  <span ng-show="((myform.txtmobno.$error.minlength || myform.txtmobno.$error.maxlength) && myform.txtmobno.$dirty) ">mobile number should 10 digits</span>                                                              </span>      </form>        </div>


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -