javascript - How to remove or hide a key-value pair of an array in AngularJS -


i have collection of objects in array this:

[   {     "name": "john doe",     "age": 25,     "city": "new york",     "country": "usa",     "group_id": 1,     "active": 1   },   {     "name": "peter parker",     "age": 44,     "city": "los angeles",     "country": "usa",     "group_id": 2,     "active": 1   },... ] 

in view want display name, age, city , country. well, question how can remove group_id , active in every object of collection? looking solution , found .slice() don't know whether right 1 , how use javascript function each object in array.

edit: more clarification. view defined below:

<md-list-item ng-repeat="citems in ::contentitems track $index">    <span ng-repeat="(key, value) in citems track $index" flex="auto">       {{ ::value }}    </span>    <md-divider></md-divider> </md-list-item> 

you can use following lines:

contentitems.foreach(function (entry) {   delete entry['group_id'];   delete entry['active']; }); 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -