Here I'm using web API with AngularJS here I'm trying to if my keyup function is not valid then its shows me please select another email.
public IHttpActionResult GetEailCount(string email)
{
int obj= objrepo.countEmployee(email);
if (obj == 1)
return Ok("Email already exist please check another...");
else
return Content(HttpStatusCode.Accepted, "Email available..");
}
AngularJS:
<input type="text" name="emailtxt" ng-model="emailsId" ngkeyup="Getvaliedemail(emailsId)" required />
<span class="help-block" ng-show="(f1.emailtxt.Getvaliedemail.$valid)">Email exist</span>
Here how can I display Error msg based on my code
$scope.Getvaliedemail = function (someval) {
if (someval.length > 3) {
Empfac.Employemail(someval).then(function (d) {
$q.resolve(d);
}).catch(function (xhr) {
$q.reject(xhr);
})
}
}
})
EmployeeFactory.Employemail = function (mail) {
debugger;
alert()
return $http({
url: 'http://localhost:63252/Api/Home/GetEailCount/' + mail,
mathod: 'GET',
headers: {
"Content-Type": "application/json"
},
data: mail
})
}