2 * Angular Material Design
3 * https://github.com/angular/material
7 goog.provide('ng.material.components.swipe');
8 goog.require('ng.material.core');
11 * @name material.components.swipe
12 * @description Swipe module!
16 * @module material.components.swipe
22 * The md-swipe-left directives allows you to specify custom behavior when an element is swiped
27 * <div md-swipe-left="onSwipeLeft()">Swipe me left!</div>
32 * @module material.components.swipe
38 * The md-swipe-right directives allows you to specify custom behavior when an element is swiped
43 * <div md-swipe-right="onSwipeRight()">Swipe me right!</div>
47 angular.module('material.components.swipe', ['material.core'])
48 .directive('mdSwipeLeft', getDirective('SwipeLeft'))
49 .directive('mdSwipeRight', getDirective('SwipeRight'));
51 function getDirective(name) {
52 var directiveName = 'md' + name;
53 var eventName = '$md.' + name.toLowerCase();
55 DirectiveFactory.$inject = ["$parse"];
56 return DirectiveFactory;
59 function DirectiveFactory($parse) {
60 return { restrict: 'A', link: postLink };
61 function postLink(scope, element, attr) {
62 var fn = $parse(attr[directiveName]);
63 element.on(eventName, function(ev) {
64 scope.$apply(function() { fn(scope, { $event: ev }); });
72 ng.material.components.swipe = angular.module("material.components.swipe");