<div loading-cover="coversIfThisIsTrue">
CONTENT
</div>
Last active
June 21, 2016 19:43
-
-
Save fracz/baf291849527607b42069fb6e0fa884a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.loading-cover { | |
position: relative; | |
.loading:before, .loading:after { | |
content: " "; | |
position: absolute; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
min-height: 50px; | |
min-width: 50px; | |
z-index: 1000; | |
} | |
.loading:before { | |
background-color: white; | |
opacity: 0.5; | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('emma').directive 'loadingCover', -> | |
restrict: 'A' | |
scope: no | |
link: (scope, element, attrs) -> | |
loadingLayer = angular.element('<div class="loading"></div>') | |
element.append(loadingLayer) | |
element.addClass('loading-cover') | |
scope.$watch attrs.loadingCover, (value) -> | |
loadingLayer.toggleClass('ng-hide', !value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment