I have implemented server side validation in mvc project.
controller code
return Json(ListErrors, JsonRequestBehavior.AllowGet);
create.js
.error(function (responseText, status, error) {
$scope.errorvalue = false;
$scope.errors = responseText;
$('#txtname').addClass('errorClass');
$scope.name = responseText;
$scope.namealert = true;
});
In responseText I'm getting list of errors with property name and error message ,

How can I bind error message to different labels based on property name?
If property name is Name then error message should be please enter name
for name input textbox
I tried like following but it gives all object value :(
<input id="txtname" type=text ng-model="Name" class="form-control">
<label ng-model="name" ng-show="namealert" style="color:red;margin-top:-35px">{{name}}</label>
output
[{"PropertyName":"Name","ErrorMessage":"Please enter Namename","AttemptedValue":null,"CustomState":null,"ErrorCode":null,"FormattedMessageArguments":null,"FormattedMessagePlaceholderValues":null}]
responseText[0].ErrorMessage?propertyNameI'm confused how Name textbox can bindNameproperty error message?<label>should have theforattribute to refer to your input,<label for="txtname"></label>if you want them to be related to each otherNameother is forDescriptionnow When I got two errors likeplease enter nameandplease enter descriptionI should apply name error to name textbox. and description error message to description textbox but i;m failed to display messages with different textbox I can display all messages at one place usingMyErrors in errorsthats is ` $scope.errors = responseText;`