javascript - json return array of objects , how to assign values to angular $scope varialbes? -


i have 2 textbox name , description 2 separate error lables them.

post create method returns error in json in array of objects , want filter messages , check if propertyname name show errormessage name textbox.

  <textarea id="txtdescription" ng-model="description" class="form-control"></textarea>     <label ng-repeat="myerror in errors (want apply filter here propertyname '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 apply filter here propertyname '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

a simple way add ng-if

<div ng-repeat="myerror in errors">    <label ng-if="myerror.propertyname === 'description'"></div> </div> 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -