A Pen by Stan Williams on CodePen.
Created
July 10, 2025 06:21
-
-
Save stanwmusic/d716a46f59afa4b005a9d125a3802eb9 to your computer and use it in GitHub Desktop.
Classic "sticky footer" with angular-material
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div ng-app="materialApp" ng-controller="AppCtrl" layout="column" layout-fill> | |
<header> | |
<md-toolbar class='md-medium-tall'> | |
<div class="md-toolbar-tools"> | |
<h1>Fixed to Top</h1> | |
<span flex></span> | |
<md-button class="md-raised" ng-click="toggleContent(!displayContent)">toggle content</md-button> | |
</div> | |
</md-toolbar> | |
</header> | |
<main class='md-padding' layout="row" flex> | |
<div flex> | |
<md-card ng-if="displayContent" ng-repeat="card in cards"> | |
{{$index}} | |
{{card.title}} | |
{{card.text}} | |
</md-card> | |
</div> | |
</main> | |
<footer> | |
<div layout="row" layout-align="center center"> | |
<h2>My Awesome Footer</h2> | |
</div> | |
</footer> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular | |
.module('materialApp', ['ngMaterial']) | |
.controller('AppCtrl', function($scope) { | |
$scope.cards = [{ | |
text: 'Bla bla bla bla bla bla bla ', | |
title: 'Bla' | |
}, { | |
text: 'Bla bla bla bla bla bla bla ', | |
title: 'Bla' | |
}, { | |
text: 'Bla bla bla bla bla bla bla ', | |
title: 'Bla' | |
}, { | |
text: 'Bla bla bla bla bla bla bla ', | |
title: 'Bla' | |
}, { | |
text: 'Bla bla bla bla bla bla bla ', | |
title: 'Bla' | |
}, { | |
text: 'Bla bla bla bla bla bla bla ', | |
title: 'Bla' | |
}, { | |
text: 'Bla bla bla bla bla bla bla ', | |
title: 'Bla' | |
}, { | |
text: 'Bla bla bla bla bla bla bla ', | |
title: 'Bla' | |
}, { | |
text: 'Bla bla bla bla bla bla bla ', | |
title: 'Bla' | |
}, { | |
text: 'Bla bla bla bla bla bla bla ', | |
title: 'Bla' | |
}, { | |
text: 'Bla bla bla bla bla bla bla ', | |
title: 'Bla' | |
}]; | |
$scope.displayContent = true; | |
$scope.toggleContent = function(showContent) { | |
$scope.displayContent = showContent; | |
}; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
md-card { | |
padding: 20px; | |
} | |
footer { | |
background-color: #ccc; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment