lundi 8 juillet 2019

how to get data from controller in ember JS?

i have a controller which fetches data from servlet like this:

import Ember from 'ember';

export default Ember.Controller.extend({


fetch : function(){

Ember.$.get('http://localhost:8080/getdata', function(data)
    {
         var json = JSON.parse(data);
    }

}.on('init')
});

how to print this data on a template? I'm not using ember data or models. The data from servlet is returned as json string.




Aucun commentaire:

Enregistrer un commentaire