2 * Angular Material Design
3 * https://github.com/angular/material
7 (function( window, angular, undefined ){
12 * @name material.components.truncate
14 MdTruncateController['$inject'] = ["$element"];
15 angular.module('material.components.truncate', ['material.core'])
16 .directive('mdTruncate', MdTruncateDirective);
21 * @module material.components.truncate
25 * The `md-truncate` component displays a label that will automatically clip text which is wider
26 * than the component. By default, it displays an ellipsis, but you may apply the `md-clip` CSS
27 * class to override this default and use a standard "clipping" approach.
29 * <i><b>Note:</b> The `md-truncate` component does not automatically adjust it's width. You must
30 * provide the `flex` attribute, or some other CSS-based width management. See the
31 * <a ng-href="./demo/truncate">demos</a> for examples.</i>
39 * <md-button>Back</md-button>
41 * <md-truncate flex>Chapter 1 - The Way of the Old West</md-truncate>
43 * <md-button>Forward</md-button>
50 * <h2 md-truncate style="max-width: 100px;">Some Title With a Lot of Text</h2>
55 * `<md-truncate>` provides two CSS classes that you may use to control the type of clipping.
57 * <i><b>Note:</b> The `md-truncate` also applies a setting of `width: 0;` when used with the `flex`
58 * attribute to fix an issue with the flex element not shrinking properly.</i>
61 * <docs-css-api-table>
63 * <docs-css-selector code=".md-ellipsis">
64 * Assigns the "ellipsis" behavior (default) which will cut off mid-word and append an ellipsis
65 * (…) to the end of the text.
66 * </docs-css-selector>
68 * <docs-css-selector code=".md-clip">
69 * Assigns the "clipping" behavior which will simply chop off the text. This may happen
70 * mid-word or even mid-character.
71 * </docs-css-selector>
73 * </docs-css-api-table>
76 function MdTruncateDirective() {
80 controller: MdTruncateController,
81 controllerAs: '$ctrl',
82 bindToController: true
87 * Controller for the <md-truncate> component.
89 * @param $element The md-truncate element.
94 function MdTruncateController($element) {
95 $element.addClass('md-truncate');
98 })(window, window.angular);