<input type ="text" ng-model="studentobj.firstname" required checkexists /> <span style="color:red" ng-show="testform.$error.required && testform.$dirty && testform.$invalid">first name Required</span> <span style="color:red" ng-show="testform.$error.checkexists ">Name Matched</span>
app.directive('checkexists',function(){ return{ restrict:'A', require:'ngModel', link:function(scope,element,attrs,ngctrl) { ngctrl.$validators.checkexists =function(ngctrl) { if(ngctrl=="phani") { return true; console.log('if'); } else{ console.log('else') return false; } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)