javascript - Vue not loading data -


i have vue/coffeescript app looks this:

there no errors in console, , says it's making successful external request json, when {{book.name}}, returns test instead of coming json.

new vue({ el: '#app', data: {   showmodal: false,   book: {     name: "test",     description: "",     photo: ""   } }  ready: () ->   this.getbookdata()   console.log (this.book)  methods: {   getbookdata: () ->     self = $(this)     $.getjson 'ggpk4a.json', (data) ->       self.book = data }  }) 

i don't know how in coffeescript, think issue this doesn't refer vue within callback function, setting this.book isn't working. can fix using .bind(this) on function, or setting var vm = this before ajax call , setting vm.book in callback.


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -