19 lines
636 B
JavaScript
19 lines
636 B
JavaScript
|
|
'use strict';
|
||
|
|
angular.module('bitcoincom.directives')
|
||
|
|
.directive('elastic', [
|
||
|
|
'$timeout',
|
||
|
|
function($timeout) {
|
||
|
|
return {
|
||
|
|
restrict: 'A',
|
||
|
|
link: function($scope, element) {
|
||
|
|
$scope.initialHeight = $scope.initialHeight || element[0].style.height;
|
||
|
|
var resize = function() {
|
||
|
|
element[0].style.height = $scope.initialHeight;
|
||
|
|
element[0].style.height = "" + element[0].scrollHeight + "px";
|
||
|
|
};
|
||
|
|
element.on("input change", resize);
|
||
|
|
$timeout(resize, 0);
|
||
|
|
}
|
||
|
|
};
|
||
|
|
}
|
||
|
|
]);
|