ionic.EventController

Methods

trigger(eventType, data, [bubbles], [cancelable])(alias: ionic.trigger)

Param Type Details
eventType string

The event to trigger.

data object

The data for the event. Hint: pass in {target: targetElement}

bubbles
(optional)
boolean

Whether the event should bubble up the DOM.

cancelable
(optional)
boolean

Whether the event should be cancelable.

on(type, callback, element)(alias: ionic.on)

Listen to an event on an element.

Param Type Details
type string

The event to listen for.

callback function

The listener to be called.

element DOMElement

The element to listen for the event on.

off(type, callback, element)(alias: ionic.off)

Remove an event listener.

Param Type Details
type string
callback function
element DOMElement

onGesture(eventType, callback, element, options)(alias: ionic.onGesture)

Add an event listener for a gesture on an element.

Available eventTypes (from hammer.js):

hold, tap, doubletap, drag, dragstart, dragend, dragup, dragdown,
dragleft, dragright, swipe, swipeup, swipedown, swipeleft, swiperight,
transform, transformstart, transformend, rotate, pinch, pinchin, pinchout,
touch, release

Param Type Details
eventType string

The gesture event to listen for.

callback function(e)

The function to call when the gesture happens.

element DOMElement

The angular element to listen for the event on.

options object

object.

  • Returns: ionic.Gesture The gesture object (use this to remove the gesture later on).

offGesture(gesture, eventType, callback)(alias: ionic.offGesture)

Remove an event listener for a gesture created on an element.

Param Type Details
gesture ionic.Gesture

The gesture that should be removed.

eventType string

The gesture event to remove the listener for.

callback function(e)

The listener to remove.