Ionic-js-events

提供:Dev Guides
移動先:案内検索

イオン-Javascriptイベント

さまざまなIonicイベントを使用して、ユーザーとの対話機能を追加できます。 次の表は、すべてのIonicイベントを説明しています。

Event Name Event Detail
on-hold Called when duration of the touch is more than 500ms.
on-tap Called when duration of the touch is less than 250ms.
on-double-tap Called when there is double tap touch.
on-touch Called immediately when touch begins.
on-release Called when touch ends.
on-drag Called when touch is moved without releasing around the page in any direction.
on-drag-up Called when element is dragged up.
on-drag-right Called when the element is dragged to the right.
on-drag-left Called when the element is dragged to the left.
on-drag-down Called when the element is dragged down.
on-swipe Called when any dragging has high velocity moving in any direction.
on-swipe-up Called when any dragging has high velocity moving up.
on-swipe-right Called when any dragging has high velocity moving to the right.
on-swipe-left Called when any dragging has high velocity moving to the left.
on-swipe-down Called when any dragging has high velocity moving down.

イベントを使用する

すべてのIonicイベントを同じ方法で使用できるため、 on-touch イベントの使用方法を示し、同じ原則を他のイベントに適用することができます。 まず、ボタンを作成し、 on-touch イベントを割り当てます。これにより、* onTouchFunction()*が呼び出されます。

<button on-touch = "onTouchFunction()" class="button">Test</button>

次に、コントローラースコープでその関数を作成します。

$scope.onTouchFunction = function() {
  //Do something...
}

現在、タッチイベントが発生すると、* onTouchFunction()*が呼び出されます。