2 * Angular Material Design
3 * https://github.com/angular/material
7 goog.provide('ng.material.components.content');
8 goog.require('ng.material.core');
11 * @name material.components.content
16 angular.module('material.components.content', [
19 .directive('mdContent', mdContentDirective);
24 * @module material.components.content
29 * The `<md-content>` directive is a container element useful for scrollable content
33 * - Add the `[layout-padding]` attribute to make the content padded.
36 * <md-content layout-padding>
37 * Lorem ipsum dolor sit amet, ne quod novum mei.
43 function mdContentDirective($mdTheming) {
46 controller: ['$scope', '$element', ContentController],
47 link: function(scope, element, attr) {
48 var node = element[0];
51 scope.$broadcast('$mdContentLoaded', element);
53 iosScrollFix(element[0]);
57 function ContentController($scope, $element) {
59 this.$element = $element;
62 mdContentDirective.$inject = ["$mdTheming"];
64 function iosScrollFix(node) {
66 // If we scroll where there is no more room for the webview to scroll,
67 // by default the webview itself will scroll up and down, this looks really
68 // bad. So if we are scrolling to the very top or bottom, add/subtract one
69 angular.element(node).on('$md.pressdown', function(ev) {
71 if (ev.pointer.type !== 't') return;
72 // Don't let a child content's touchstart ruin it for us.
73 if (ev.$materialScrollFixed) return;
74 ev.$materialScrollFixed = true;
76 if (node.scrollTop === 0) {
78 } else if (node.scrollHeight === node.scrollTop + node.offsetHeight) {
84 ng.material.components.content = angular.module("material.components.content");