I have recently started learning ember.js and facing some problem in rest adapter. My code is like this
App = Ember.Application.create();
App.Router.map(function() {
this.resource('about');
this.resource('posts');
});
App.Posts = DS.Model.extend({
response: DS.attr('string')
});
App.Store = DS.Store.extend({
revision: 12,
adapter: DS.RESTAdapter.create({
namespace: '89/gz/connectweb/timeliner/js/data.json',
host: 'http://local_env.mhhe.com'
})
});
App.PostsRoute = Ember.Route.extend({
model: function (posts) {
var jsondata = this.store.find(posts);
return jsondata;
}
});
App.PostsView = Ember.View.extend({
didInsertElement : function(){
// this._super();
var jsondata = $('#restdata').html();
var s_date = jsondata.split("</script>");
var final_data = s_date[1].split("<script");
var jsonarray = JSON.parse(final_data[0]);
console.log(jsonarray);
timeLineData(jsonarray)
// perform your jQuery logic here
}
});
i have edited by code. In this i am successfully able to hin the url and get data in response if i check this by doing inspect element but now this data is not getting accessed in route. I just want to know atleast whats wrong here .