angularjs - Angular input Validations not working -


<form name="lpform">      <div class="form-row clearfix">           <label class="lbl-fld" style="margin-left: 12%;">email id</label>           <input class="mob-adj-inpbx" type="email" name="uemail" ng-model="useremail" placeholder=" me@example.com" ng-required="true"/>           <div ng-show="lpform.uemail.$valid">enter valid email.</div>      </div>  </form>

here, i'm adding validations 'email' , trying display error message when user enters invalid email. not working.

  1. i suppose want show error message if input invalid so

    ng-show="!lpform.uemail.$valid"

  2. maybe forgot bind scope variable? cause seems work fine.

function ctrl($scope) {    $scope.useremail = '';  }
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.9/angular.min.js"></script>  <div ng-app>    <div ng-controller="ctrl">      <form name="lpform">        <div class="form-row clearfix">          <label class="lbl-fld">email id</label>          <input class="mob-adj-inpbx" type="email" name="uemail" ng-model="useremail" placeholder=" me@example.com" ng-required="true" />          <div style="font-size: 11px; color: red; margin: 5px 65px;"                ng-show="!lpform.uemail.$valid">please enter valid email.</div>        </div>      </form>    </div>  </div>


Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -