I am trying to render a details view based on what gets clicked on the list view (parent/child view). So I have nested route as below;
this.route('my-list', function() {
this.route('my-details', {
path: '/details'
});
});
Also my child/details route looks like below
export default Ember.Route.extend({
model: function(params){
var detailsUrl = "/myApp/json/" + params.myCode + "/details";
var detailsRequest = new Ember.RSVP.Promise(function(resolve, reject) {
Ember.$.ajax({
url: detailsUrl,
type: "POST",
data: JSON.stringify({
'id': params.Id
}),
contentType: 'application/json;charset=utf-8',
dataType: 'json',
success: function(response) {
resolve(response);
},
error: function(reason) {
reject(reason);
}
});
});
detailsRequest.then(function(response) {
return response; // I do get the correct response here
}, function(error) {
});
},
setupController: function(controller, model) {
debugger;
controller.set('model', model);
}
});
And my child/details controller looks like below
export default Ember.Controller.extend({
queryParams: ['myCode','Id'],
productCode: null
});
And my child template is as below; (I have a {{outlet}} in my parent/list template)
<p>Child details </p>
someId : {{model.someId}}
While I am able to make the AJAX call to "/myApp/json/" + params.myCode + "/details" and get the response, it is not getting rendered to the child template
I noticed the setupController not getting called. Does it have to be manually called OR should it get called automatically (Do rememeber I am using a nested view)
Aucun commentaire:
Enregistrer un commentaire