Adding touch events

Given that we are building this app mainly for mobile and tablet devices, it's crucial to allow touch and swipe events.

Enabling swipe gestures using ngTouch

Thankfully, AngularJS comes with a nice module called ngTouch, which allows us to easily add touch and swipe gestures. The ngTouch file doesn't come as a default with AngularJS and needs to be included separately.

Download the ngTouch file using bower by typing the following command in the terminal:

bower install angular-touch --save

We'll include ngTouch by adding the following script file in our app/index.html file, as highlighted in the following code:

<script src="bower_components/angular-touch/angular-touch.js"></script>

Make sure that ngTouch is called after AngularJS. ...

Get AngularJS Web Application Development Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.