2 * Angular Material Design
3 * https://github.com/angular/material
7 (function( window, angular, undefined ){
12 * @name material.components.showHide
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 Angular's built-in ng-hide and ng-show directives.
18 angular.module('material.components.showHide', [
21 .directive('ngShow', createDirective('ngShow', true))
22 .directive('ngHide', createDirective('ngHide', false));
25 function createDirective(name, targetValue) {
26 return ['$mdUtil', '$window', function($mdUtil, $window) {
30 link: function($scope, $element, $attr) {
31 var unregister = $scope.$on('$md-resize-enable', function() {
34 var node = $element[0];
35 var cachedTransitionStyles = node.nodeType === $window.Node.ELEMENT_NODE ?
36 $window.getComputedStyle(node) : {};
38 $scope.$watch($attr[name], function(value) {
39 if (!!value === targetValue) {
40 $mdUtil.nextTick(function() {
41 $scope.$broadcast('$md-resize');
45 cachedTransitionStyles: cachedTransitionStyles
48 $mdUtil.dom.animator.waitTransitionEnd($element, opts).then(function() {
49 $scope.$broadcast('$md-resize');
59 })(window, window.angular);