0

I have two textbox Name and Description with two separate error lables for them.

post create method returns error in json in array of objects , I want to filter those messages and check if propertyName is Name then show that errorMessage to Name textbox.

  <textarea id="txtDescription" ng-model="Description" class="form-control"></textarea>
    <label ng-repeat="MyError in errors (want to apply filter here where propertyName is 'Description')" ng-model="Description" ng-show="Descriptionalert">{{MyError.ErrorMessage}}</label>


     <textarea id="txtName" ng-model="NAme" class="form-control"></textarea>
    <label ng-repeat="MyError in errors (want to apply filter here where propertyName is 'Name')" ng-model="Description" ng-show="Descriptionalert">{{MyError.ErrorMessage}}</label>


  .error(function (responseText, status, error) {
                            $scope.errorvalue = false;
                            $scope.errors = responseText;

enter image description here

1 Answer 1

1

A simple way is to add ng-if

<div ng-repeat="MyError in errors">
   <label ng-if="MyError.PropertyName === 'Description'"></div>
</div>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.