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.

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

READ :  AngularJS Change Dynamically Title Element Based on Routing

Installation

First of all include this script in your Application

"http://ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/angular-touch.js"

Include ng-touch

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

angular.module('myApp', ['ngTouch']);

index.html

<div class="row">
	<div class="device-title">
	{{device.deviceName}}
	<i class="pull-right glyphicon"></i>
	</div>
</div>

App.js

.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();
				});
			};
		}
	};
}); 

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

angular.module('ngClick', function( $location ) {
  return {
    link: function(scope, elem, attrs) {
      if(attrs.href) {
        elem.on('touchend', function() {
          $location.path(attrs.href);        
        });
      }
    },
    priority: 1
  };
});

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.

READ :  ngTouch event example using angularjs-ngtouch directive

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

Add a Comment

Your email address will not be published. Required fields are marked *