I am using ember-modal-dialog addon for the dialog features in my app.Now the data shown in dialog is requested from server.So every time I click on button it should request the server and show the received data.
feed.hbs
{{#each feedResult as |feed|}}
<p {{action "toggleModal" feed.fivers_pk }}> {{feed.numFives}} </p>
{{#if isShowingModal}}
{{#modal-dialog close="toggleModal"}}
<p>People who Hi-Fived this</p>
<img src = "images/shape-line-separator.png">
Data from server
{{/modal-dialog}}
{{/if}}
{{/each}
Controller.js(feed.js)
import Ember from 'ember';
import raw from 'ic-ajax';
const { service } = Ember.inject;
export default Ember.Controller.extend({
session:service('session'),
isShowingModal: false,
fivers:[],
feedResult:Ember.computed('model',function() {
SOME MANIPULATION WITH DATA
}),
actions:{
toggleModal: function(fiverpk) {
this.toggleProperty('isShowingModal');
console.log(fiverpk);
raw({
url: "http://ift.tt/1QZarQQ"+fiverpk+"/fivers/",
type: 'GET',
});
},
}
});
I am able to make the request to server and receive the data through the ajax call in actions.But where and how should I store it.So that I can use it in modal-dialog when it opens.
Aucun commentaire:
Enregistrer un commentaire