I am trying to setup a modal window as sated in this post :
http://ift.tt/1Tfplhs
the author indicated that the openModal action, is written in the app/controllers/application.js ...
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
openModal: function(targetId) {
var modal = Ember.Views.views[targetId];
modal.send('toggleModal');
}
}
});
However , I am using the component from the books list page , using a test button
<button >Open Author Modal Window</button>
Modal text. Oh girl!
So, I tried ( I maybe wrong ...) to insert the openModal action ( when the button is clicked) into the book.js route
// app/routes/books.js
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return this.store.findAll('book');
},
actions: {
openModal: function(targetId) {
var modal = Ember.View.views[targetId];
modal.send('toggleModal');
},
....
}
});
in this case , I get an error Ember.view seems to be undefined ...
books.js:11 Uncaught TypeError: Cannot read property 'views' of undefined
Aucun commentaire:
Enregistrer un commentaire