Ember : 1.10.0
Ember Data : 1.0.0-beta.16
jQuery : 1.11.2
I'm using this.container.lookup in order to create a view dynamically in my controller like this:
var popup = this.container.lookup('view:map-popup', {singleton: false});
var ctrl = this.container.lookup('controller:map-popup', {singleton: false});
popup.set('controller', ctrl);
popup.createElement();
the view is defined like this:
export default Ember.View.extend({
templateName: "mapPopup",
classNames: ["map-popup"]
});
The view template:
<a class="popup-closer" {{action 'closePopup'}}></a>
<div class="popup-content">{{content}}</div>
and the view's controller:
export default Ember.ObjectController.extend({
hide: function() {
console.log("i'm hidden");
},
actions: {
closePopup: function() {
this.hide();
}
}
});
The view is inserted correctly in the DOM by my controller:
<div class="ember-view map-popup" id="ember643">
<a data-ember-action="645" class="popup-closer"></a>
<div class="popup-content">571187.3674937992,5721182.413928764</div>
</div>
But nothing happens when I click on the popup-closer.
I would be glad if someone could show me how to bind the action to the view's controller.
Aucun commentaire:
Enregistrer un commentaire