nexus site path corrected
[portal.git] / ecomp-portal-FE / client / bower_components / angular-material / modules / closure / swipe / swipe.js
1 /*!
2  * Angular Material Design
3  * https://github.com/angular/material
4  * @license MIT
5  * v0.9.8
6  */
7 goog.provide('ng.material.components.swipe');
8 goog.require('ng.material.core');
9 /**
10  * @ngdoc module
11  * @name material.components.swipe
12  * @description Swipe module!
13  */
14 /**
15  * @ngdoc directive
16  * @module material.components.swipe
17  * @name mdSwipeLeft
18  *
19  * @restrict A
20  *
21  * @description
22  * The md-swipe-left directives allows you to specify custom behavior when an element is swiped
23  * left.
24  *
25  * @usage
26  * <hljs lang="html">
27  * <div md-swipe-left="onSwipeLeft()">Swipe me left!</div>
28  * </hljs>
29  */
30 /**
31  * @ngdoc directive
32  * @module material.components.swipe
33  * @name mdSwipeRight
34  *
35  * @restrict A
36  *
37  * @description
38  * The md-swipe-right directives allows you to specify custom behavior when an element is swiped
39  * right.
40  *
41  * @usage
42  * <hljs lang="html">
43  * <div md-swipe-right="onSwipeRight()">Swipe me right!</div>
44  * </hljs>
45  */
46
47 angular.module('material.components.swipe', ['material.core'])
48     .directive('mdSwipeLeft', getDirective('SwipeLeft'))
49     .directive('mdSwipeRight', getDirective('SwipeRight'));
50
51 function getDirective(name) {
52   var directiveName = 'md' + name;
53   var eventName = '$md.' + name.toLowerCase();
54
55     DirectiveFactory.$inject = ["$parse"];
56   return DirectiveFactory;
57
58   /* ngInject */
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 }); });
65         });
66       }
67     }
68 }
69
70
71
72 ng.material.components.swipe = angular.module("material.components.swipe");