diff --git a/src/components/datepicker/js/calendarMonth.js b/src/components/datepicker/js/calendarMonth.js index 803c270f37..bb08d3a80e 100644 --- a/src/components/datepicker/js/calendarMonth.js +++ b/src/components/datepicker/js/calendarMonth.js @@ -37,7 +37,7 @@ // The ensures that the will always have the // proper height, even if it's empty. If it's content is // compiled, the will be overwritten. - '' + + '' + '' + '' + '' + diff --git a/src/components/datepicker/js/calendarYear.js b/src/components/datepicker/js/calendarYear.js index 6079bfb5a2..42f36c42c4 100644 --- a/src/components/datepicker/js/calendarYear.js +++ b/src/components/datepicker/js/calendarYear.js @@ -26,7 +26,7 @@ 'md-item-size="' + TBODY_HEIGHT + '">' + // The ensures that the will have the proper // height, even though it may be empty. - '' + + '' + '' + '' + '' + diff --git a/src/components/virtualRepeat/virtual-repeater.js b/src/components/virtualRepeat/virtual-repeater.js index 3c568d5010..1c05295fcb 100644 --- a/src/components/virtualRepeat/virtual-repeater.js +++ b/src/components/virtualRepeat/virtual-repeater.js @@ -7,7 +7,8 @@ angular.module('material.components.virtualRepeat', [ 'material.components.showHide' ]) .directive('mdVirtualRepeatContainer', VirtualRepeatContainerDirective) -.directive('mdVirtualRepeat', VirtualRepeatDirective); +.directive('mdVirtualRepeat', VirtualRepeatDirective) +.directive('mdForceHeight', ForceHeightDirective); /** @@ -989,3 +990,32 @@ VirtualRepeatModelArrayLike.prototype.$$includeIndexes = function(start, end) { } this.length = this.model.getLength(); }; + +/** + * @ngdoc directive + * @name mdForceHeight + * @module material.components.virtualRepeat + * @restrict A + * @description + * + * Force an element to have a certain px height. This is used in place of a style tag in order to + * conform to the Content Security Policy regarding unsafe-inline style tags. + * + * @usage + * + *
+ *
+ */ +function ForceHeightDirective($mdUtil) { + return { + restrict: 'A', + link: function(scope, element, attrs) { + var height = scope.$eval(attrs.mdForceHeight) || null; + + if (height && element) { + element[0].style.height = height; + } + } + } +} +ForceHeightDirective.$inject = ['$mdUtil'];