2 * Angular Material Design
3 * https://github.com/angular/material
7 (function( window, angular, undefined ){
12 * @name material.components.whiteframe
14 MdWhiteframeDirective['$inject'] = ["$log"];
16 .module('material.components.whiteframe', ['material.core'])
17 .directive('mdWhiteframe', MdWhiteframeDirective);
21 * @module material.components.whiteframe
25 * The md-whiteframe directive allows you to apply an elevation shadow to an element.
27 * The attribute values needs to be a number between 1 and 24 or -1.
28 * When set to -1 no style is applied.
31 * - If there is no value specified it defaults to 4dp.
32 * - If the value is not valid it defaults to 4dp.
36 * <div md-whiteframe="3">
37 * <span>Elevation of 3dp</span>
42 * <div md-whiteframe="-1">
43 * <span>No elevation shadow applied</span>
48 * <div ng-init="elevation = 5" md-whiteframe="{{elevation}}">
49 * <span>Elevation of 5dp with an interpolated value</span>
53 function MdWhiteframeDirective($log) {
63 function postLink(scope, element, attr) {
66 attr.$observe('mdWhiteframe', function(elevation) {
67 elevation = parseInt(elevation, 10) || DEFAULT_DP;
69 if (elevation != DISABLE_DP && (elevation > MAX_DP || elevation < MIN_DP)) {
70 $log.warn('md-whiteframe attribute value is invalid. It should be a number between ' + MIN_DP + ' and ' + MAX_DP, element[0]);
71 elevation = DEFAULT_DP;
74 var newClass = elevation == DISABLE_DP ? '' : 'md-whiteframe-' + elevation + 'dp';
75 attr.$updateClass(newClass, oldClass);
82 })(window, window.angular);