I have a little open source library of components that work with touch gestures made using ionic on-drag, on-drag-start, on-drag-end directives (because they work on mobile). Now i'm trying to port it to angular 2. But i can't find how to do that with ionic 2. Here's the code from the Angular 1 version
.directive('clockEditor', function () {
return {
restrict: "E",
scope: { from: '=', to: '=' },
template:'<div on-drag-start="onTouch($event)" on-drag-end="onRelease()" on-drag="drag($event)">\
</div>',
controller: function($scope){
$scope.onTouch = function(event){
// code
};
$scope.onRelease = function(){
// code
};
$scope.drag = function(event){
// code
};
}
}
This is from angular 2 version
import {Component, OnChanges, OnInit, Input, Output, EventEmitter} from '@angular/core';
@Component({
selector: 'clock-editor',
template: `
<div style="margin: auto; height: 250px; width: 350px;" draggable="true" (dragstart)="onTouch($event)" (dragend)="onRelease()" (drag)="drag($event)">
</div>`,
})
export class ClockEditor implements OnChanges, OnInit {
onTouch(event){
// code
};
onRelease(){
// code
};
drag(event){
// code
};
}