| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- /*!
- * AngularJS Material Design
- * https://github.com/angular/material
- * @license MIT
- * v1.1.8-master-aba7b2b
- */
- goog.provide('ngmaterial.components.showHide');
- goog.require('ngmaterial.core');
- /**
- * @ngdoc module
- * @name material.components.showHide
- */
- // Add additional handlers to ng-show and ng-hide that notify directives
- // contained within that they should recompute their size.
- // These run in addition to AngularJS's built-in ng-hide and ng-show directives.
- angular.module('material.components.showHide', [
- 'material.core'
- ])
- .directive('ngShow', createDirective('ngShow', true))
- .directive('ngHide', createDirective('ngHide', false));
- function createDirective(name, targetValue) {
- return ['$mdUtil', '$window', function($mdUtil, $window) {
- return {
- restrict: 'A',
- multiElement: true,
- link: function($scope, $element, $attr) {
- var unregister = $scope.$on('$md-resize-enable', function() {
- unregister();
- var node = $element[0];
- var cachedTransitionStyles = node.nodeType === $window.Node.ELEMENT_NODE ?
- $window.getComputedStyle(node) : {};
- $scope.$watch($attr[name], function(value) {
- if (!!value === targetValue) {
- $mdUtil.nextTick(function() {
- $scope.$broadcast('$md-resize');
- });
- var opts = {
- cachedTransitionStyles: cachedTransitionStyles
- };
- $mdUtil.dom.animator.waitTransitionEnd($element, opts).then(function() {
- $scope.$broadcast('$md-resize');
- });
- }
- });
- });
- }
- };
- }];
- }
- ngmaterial.components.showHide = angular.module("material.components.showHide");
|