Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mjamin on github.
  • I am mjamin (https://keybase.io/mjamin) on keybase.
  • I have a public key whose fingerprint is D094 D76F 23E1 ED21 C3FE BD55 1169 881A 2D83 FC03

To claim this, I am signing this object:

@mjamin
mjamin / fillHeight.js
Last active November 2, 2020 15:41
AngularJS fill-height directive: sets an element's height so it fills up the remaining space in the viewport
angular.module('app').directive('fillHeight', [
'$window',
function ($window) {
return {
restrict: 'A',
link: function (scope, e) {
var initialHeight = e[0].offsetHeight;
var fill = function () {
angular.element(e).css('height', Math.max(initialHeight, $window.innerHeight - e[0].offsetTop) + 'px');