source: trip-planner-front/node_modules/angular-material/modules/js/showHide/showHide.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*!
2 * AngularJS Material Design
3 * https://github.com/angular/material
4 * @license MIT
5 * v1.2.3
6 */
7(function( window, angular, undefined ){
8"use strict";
9
10/**
11 * @ngdoc module
12 * @name material.components.showHide
13 */
14
15// Add additional handlers to ng-show and ng-hide that notify directives
16// contained within that they should recompute their size.
17// These run in addition to AngularJS's built-in ng-hide and ng-show directives.
18angular.module('material.components.showHide', [
19 'material.core'
20])
21 .directive('ngShow', createDirective('ngShow', true))
22 .directive('ngHide', createDirective('ngHide', false));
23
24
25function createDirective(name, targetValue) {
26 return ['$mdUtil', '$window', function($mdUtil, $window) {
27 return {
28 restrict: 'A',
29 multiElement: true,
30 link: function($scope, $element, $attr) {
31 var unregister = $scope.$on('$md-resize-enable', function() {
32 unregister();
33
34 var node = $element[0];
35 var cachedTransitionStyles = node.nodeType === $window.Node.ELEMENT_NODE ?
36 $window.getComputedStyle(node) : {};
37
38 $scope.$watch($attr[name], function(value) {
39 if (!!value === targetValue) {
40 $mdUtil.nextTick(function() {
41 $scope.$broadcast('$md-resize');
42 });
43
44 var opts = {
45 cachedTransitionStyles: cachedTransitionStyles
46 };
47
48 $mdUtil.dom.animator.waitTransitionEnd($element, opts).then(function() {
49 $scope.$broadcast('$md-resize');
50 });
51 }
52 });
53 });
54 }
55 };
56 }];
57}
58
59})(window, window.angular);
Note: See TracBrowser for help on using the repository browser.