I am trying to do something fairly simple using Ionic framework.
<form>
<div class="list">
<div>
<img ng-src="some_image_source"></img>
</div>
<label class="item item-input">
<input type="text" placeholder="What do you need to do?" ng-model="task.title">
</label>
</div>
<div class="padding">
<button on-touch="beginInterest(event)" class="button button-block button-positive">Create Task</button>
</div>
I want to capture the event object and associated data from this touch event in beginInterest function which is defined in my controller like so
$scope.beginInterest = function (event) {
// But there is no event object here! It's undefined.
}
Am I doing something wrong here?
I think you need to do ng-touch="beginInterest($event)"
and you need to load angular-touch.js
and have ngTouch
on your app dependencies (e.g. angular.module('myApp',['ngTouch'])
. documentation here: https://docs.angularjs.org/api/ngTouch