Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save heckmac/f96b824270abb8431923 to your computer and use it in GitHub Desktop.
Save heckmac/f96b824270abb8431923 to your computer and use it in GitHub Desktop.
Classic "sticky footer" with angular-material
<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>
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;
};
});
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