Reputation: 935
I'm trying to have an element be able to be clicked on by both touchscreens, and clicking, through the events touchStart
and click
.
How can I get both of these events connected to one Ember view?
I have tried:
{{action "itsClicked" on="click touchMove"}}
{{action "itsClicked" on="click, touchMove"}}
{{action "itsClicked" on="click"}} {{action "itsClicked" on="touchMove"}}
Upvotes: 3
Views: 4744
Reputation: 908
Multiple actions are not supported - this forces you separate your code by creating components (or views).
However, you can easily solve the click/touch issue for your application by creating a custom event:
App = Ember.Application.create({
customEvents: {touchend: "click"}
});
This means all your "click" events will fire when touched
Upvotes: 0
Reputation: 16143
This is currently not supported. But there is an open issue about this, see #569 in the GitHub issue tracker. You should add a comment.
The suggested solution from the GitHub issue is to use a custom view, something like this:
Ember.View.extend({
click: function(evt) {
this.fire('itsClicked', evt);
},
touchMove: function() {
this.fire('itsClicked', evt);
},
itsClicked: function(e) {
...
}
})
Upvotes: 6