2👍
By changing the for loop like so, this worked:
el: '#adresponse',
ready: function() {
this.fetchMessages();
},
data: {
classified_bids: {},
accept_qty: {},
submitted: false
},
methods: {
fetchMessages: function () {
this.$http.get('/api/getbids')
.success(function (bids) {
this.classified_bids = bids;
for (var key in this.classified_bids) {
this.accept_qty[key] = 0;
}
});
}
}
});
0👍
Your problem is the value of this
inside the .success()
callback.
You could try something like this:
this.$http.get('/api/getbids')
.success(function (bids) {
this.classified_bids = bids;
for (i = 0; i < this.classified_bids.length; i++) {
this.accept_qty[i] = 0;
}
}.bind(this));
Source:stackexchange.com