AngularJs ng click and ng touch mobile device

AngularJs ng click and ng touch mobile device

Today, We want to share with you AngularJs ng click and ng touch mobile device.
In this post we will show you AngularJs ng click and ng touch mobile device, hear for AngularJs ng click and ng touch mobile device we will give you demo and example for implement.
In this post, we will learn about AngularJs ng click and ng touch mobile device with an example.

READ :  Angular get post Method in php MySQLi

The ngTouch keywords module provides all the functionality helpers for touch-enabled devices.like as a mobile,teblat device for AngularJs ng-click and ng-touch mobile device.

Module Components

There are the following two types of the Module Components.
1.ngSwipeRight
2.ngSwipeLeft

Installation

First of all include this script in your Application

[php]
“http://ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/angular-touch.js”
[/php]

Include ng-touch

Second thing include this keywords in angularjs module.and here module name is myApp.

[php]
angular.module(‘myApp’, [‘ngTouch’]);
[/php]

index.html

[php]

{{device.deviceName}}

[/php]

App.js

[php]
.directive(‘basicClick’, function($parse, $rootScope) {
return {
compile: function(elem, attr) {
var fn = $parse(attr.basicClick);
return function(scope, elem) {
elem.on(‘click’, function(e)
{
fn(scope, {$event: e});
scope.$apply();
});
};
}
};
});
[/php]

other way to Fix ng-click working on mobile devices.

[php]
angular.module(‘ngClick’, function( $location ) {
return {
link: function(scope, elem, attrs) {
if(attrs.href) {
elem.on(‘touchend’, function() {
$location.path(attrs.href);
});
}
},
priority: 1
};
});
[/php]

READ :  AngularJs Global Constants Set and Get Variables

Example

We hope you get an idea about AngularJs ng click and ng touch mobile device
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.

We hope This Post can help you…….Good Luck!.

Leave a Comment