0👍
The scope of this
is not what you think. In your case, this
is the jqXHR
object of the Ajax call, not the Vue instance.
You should assign this
to a support variable:
getFederations: function() {
var url = '/api/v1/federationsofcats';
var myVm = this;
$.getJSON(url, function (data) {
console.log(data);
myVm.federations = data;
});
}
- [Vuejs]-Usng Vue.js to push dynamically created inputs to an array
- [Vuejs]-How to get started with running vue js examples/demos
Source:stackexchange.com