我从后端得到的回复是手机号码已经存在或是新的手机号码。但是无法在我的表格中显示手机号码已经注册的验证。任何人都可以帮助我
<div>
<md-content ng-app="shoppingPad" ng-controller="loginController">
<p class="Welcome-to-ShoppingP">Welcome to ShoppingPad</p>
<div>
<form name="myForm" ng-app="shoppingPad" class="myForm" ng-submit="submit()">
<div class="row formData">
<div class="col-xs-8">
<md-input-container>
<md-icon md-svg-icon="assets/images/device.svg"></md-icon>
<input type="number" placeholder="Enter user mobile no" name="mobile" id="mobile" ng-model="mobile" required phone-number-validator minlength="10">
<div ng-messages="myForm.mobile.$error">
<div ng-message="required">Registered mobile no.</div>
<div ng-message="phoneNumber">The mobile No entered has already been registered</div>
<div ng-message="test">too short</div>
</div>
</md-input-container>
</div>
<div class="col-xs-8">
<md-input-container>
<md-icon md-svg-icon="assets/images/lock.svg"></md-icon>
<input type="password" placeholder="Enter 3-D secure pin" name="password" id="password" ng-model="password" required minlength="6">
<div ng-messages="myForm.password.$error">
<div ng-message="required">Enter Pin no.</div>
<div ng-message="minlength">too short</div>
</div>
</md-input-container>
</div>
</div>
<!-- end of login form-->
<!-- login toolbar-->
<div>
<md-toolbar class="loginToolBar">
<md-button class="md-primary" ng-disabled="myForm.$invalid" style="margin-top: 15px;outline: none;" ng-click="login()">LOGIN</md-button>
</md-toolbar>
</div>
</form>
</div>
</md-content>
</div>
angular.module('shoppingPad').directive('phoneNumberValidator',phoneNumberValidator)
function phoneNumberValidator($q,restService){
var deferred=$q.defer();
return{
restrict:'EA',
require:'ngModel',
link:function($scope,element,attrs,ngModel){
ngModel.$asyncValidators.phoneNumber=function(modelValue , viewValue) {
var mobile= (modelValue || viewValue).toString();
console.log(mobile);
ngModel.$asyncValidators.userMobile=function(mobile){
return restService.getRequest('save/all',null).then(function(response){
console.log("inside get");
return deferred.promise;
},
function(error){
deferred.reject(error);
return deferred.promise;
}
)
};
}
}
}
}