I need to do a click and hold for x seconds then run an event.
In the app the events run if I do a single click but, when I click and hold none of them fire?
This works fine as the plunker below shows, but can't seem to get it working in the app.
https://plnkr.co/edit/0gBDn0ZfCKXYHJiwq5eQ?p=preview
I have also tried:
<span (mousedown)="mousedown()" (mouseup)="mouseup()" (mouseleave)="mouseup()">
Title
</span>
and applying:
this.elementRef.nativeElement.addEventListener('mousedown', () => {
setTimeout(() => {
console.log('mouse mousedown');
}, 500);
});
also even using
private elementRef: ElementRef,
private renderer: Renderer
and using
this.renderer.listen(this.listener.nativeElement, 'mousedown', (event) => {
console.log('mouse down', event);
});
this.renderer.listen(this.listener.nativeElement, 'mouseup', (event) => {
// Do something with 'event'
console.log('mouse up', event);
});
But I get the same behaviour with all methods: single click works but click and hold fires nothing.
angular cli v 1.0
angular 4.0.0
Any ideas?