2 * Angular Material Design
3 * https://github.com/angular/material
7 goog.provide('ngmaterial.components.whiteframe');
8 goog.require('ngmaterial.core');
11 * @name material.components.whiteframe
13 MdWhiteframeDirective['$inject'] = ["$log"];
15 .module('material.components.whiteframe', ['material.core'])
16 .directive('mdWhiteframe', MdWhiteframeDirective);
20 * @module material.components.whiteframe
24 * The md-whiteframe directive allows you to apply an elevation shadow to an element.
26 * The attribute values needs to be a number between 1 and 24 or -1.
27 * When set to -1 no style is applied.
30 * - If there is no value specified it defaults to 4dp.
31 * - If the value is not valid it defaults to 4dp.
35 * <div md-whiteframe="3">
36 * <span>Elevation of 3dp</span>
41 * <div md-whiteframe="-1">
42 * <span>No elevation shadow applied</span>
47 * <div ng-init="elevation = 5" md-whiteframe="{{elevation}}">
48 * <span>Elevation of 5dp with an interpolated value</span>
52 function MdWhiteframeDirective($log) {
62 function postLink(scope, element, attr) {
65 attr.$observe('mdWhiteframe', function(elevation) {
66 elevation = parseInt(elevation, 10) || DEFAULT_DP;
68 if (elevation != DISABLE_DP && (elevation > MAX_DP || elevation < MIN_DP)) {
69 $log.warn('md-whiteframe attribute value is invalid. It should be a number between ' + MIN_DP + ' and ' + MAX_DP, element[0]);
70 elevation = DEFAULT_DP;
73 var newClass = elevation == DISABLE_DP ? '' : 'md-whiteframe-' + elevation + 'dp';
74 attr.$updateClass(newClass, oldClass);
81 ngmaterial.components.whiteframe = angular.module("material.components.whiteframe");