2 * Angular Material Design
3 * https://github.com/angular/material
7 (function( window, angular, undefined ){
12 * @name material.components.swipe
13 * @description Swipe module!
17 * @module material.components.swipe
23 * The md-swipe-left directives allows you to specify custom behavior when an element is swiped
28 * <div md-swipe-left="onSwipeLeft()">Swipe me left!</div>
33 * @module material.components.swipe
39 * The md-swipe-right directives allows you to specify custom behavior when an element is swiped
44 * <div md-swipe-right="onSwipeRight()">Swipe me right!</div>
48 angular.module('material.components.swipe', ['material.core'])
49 .directive('mdSwipeLeft', getDirective('SwipeLeft'))
50 .directive('mdSwipeRight', getDirective('SwipeRight'));
52 function getDirective(name) {
53 var directiveName = 'md' + name;
54 var eventName = '$md.' + name.toLowerCase();
56 DirectiveFactory.$inject = ["$parse"];
57 return DirectiveFactory;
60 function DirectiveFactory($parse) {
61 return { restrict: 'A', link: postLink };
62 function postLink(scope, element, attr) {
63 var fn = $parse(attr[directiveName]);
64 element.on(eventName, function(ev) {
65 scope.$apply(function() { fn(scope, { $event: ev }); });
73 })(window, window.angular);