0๐
โ
Is this what youโre looking for?
this.list.forEach(function (obj) {
obj.editMode = false;
});
0๐
this.list = data.json();
for (var i=0;i<this.list.length;i++){
this.list[i].editMode=false;
}
0๐
this.list.forEach(o => o.editMode = false)
But only if you donโt care about them being reactive. Otherwise you should use Vue.set
0๐
Put your array in an variable and then iterate that variable and add accordingly.
<script>
var xyz = [{"id":1,"body":"test body"},{"id":2,"body":"blablablabla"}];
$.each(xyz,function(i,data){
data['editMode'] = false;
})
</script>
Put this code Along with jquery library or you can write for loop in javascrpt you will get your desired output
-1๐
After the ajax call, it sounds like a simple for
loop should work:
for(var i = this.list.length; i--;){
this.list[i].editMode=false;
}
Source:stackexchange.com