2 * Angular Material Design
3 * https://github.com/angular/material
7 (function( window, angular, undefined ){
12 * @name material.components.content
17 angular.module('material.components.content', [
20 .directive('mdContent', mdContentDirective);
25 * @module material.components.content
30 * The `<md-content>` directive is a container element useful for scrollable content
34 * - Add the `[layout-padding]` attribute to make the content padded.
37 * <md-content layout-padding>
38 * Lorem ipsum dolor sit amet, ne quod novum mei.
44 function mdContentDirective($mdTheming) {
47 controller: ['$scope', '$element', ContentController],
48 link: function(scope, element, attr) {
49 var node = element[0];
52 scope.$broadcast('$mdContentLoaded', element);
54 iosScrollFix(element[0]);
58 function ContentController($scope, $element) {
60 this.$element = $element;
63 mdContentDirective.$inject = ["$mdTheming"];
65 function iosScrollFix(node) {
67 // If we scroll where there is no more room for the webview to scroll,
68 // by default the webview itself will scroll up and down, this looks really
69 // bad. So if we are scrolling to the very top or bottom, add/subtract one
70 angular.element(node).on('$md.pressdown', function(ev) {
72 if (ev.pointer.type !== 't') return;
73 // Don't let a child content's touchstart ruin it for us.
74 if (ev.$materialScrollFixed) return;
75 ev.$materialScrollFixed = true;
77 if (node.scrollTop === 0) {
79 } else if (node.scrollHeight === node.scrollTop + node.offsetHeight) {
85 })(window, window.angular);