You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.6 KiB

  1. /*!
  2. * Angular Material Design
  3. * https://github.com/angular/material
  4. * @license MIT
  5. * v1.1.1
  6. */
  7. goog.provide('ngmaterial.components.fabActions');
  8. goog.require('ngmaterial.core');
  9. (function() {
  10. 'use strict';
  11. /**
  12. * @ngdoc module
  13. * @name material.components.fabActions
  14. */
  15. MdFabActionsDirective.$inject = ["$mdUtil"];
  16. angular
  17. .module('material.components.fabActions', ['material.core'])
  18. .directive('mdFabActions', MdFabActionsDirective);
  19. /**
  20. * @ngdoc directive
  21. * @name mdFabActions
  22. * @module material.components.fabActions
  23. *
  24. * @restrict E
  25. *
  26. * @description
  27. * The `<md-fab-actions>` directive is used inside of a `<md-fab-speed-dial>` or
  28. * `<md-fab-toolbar>` directive to mark an element (or elements) as the actions and setup the
  29. * proper event listeners.
  30. *
  31. * @usage
  32. * See the `<md-fab-speed-dial>` or `<md-fab-toolbar>` directives for example usage.
  33. */
  34. function MdFabActionsDirective($mdUtil) {
  35. return {
  36. restrict: 'E',
  37. require: ['^?mdFabSpeedDial', '^?mdFabToolbar'],
  38. compile: function(element, attributes) {
  39. var children = element.children();
  40. var hasNgRepeat = $mdUtil.prefixer().hasAttribute(children, 'ng-repeat');
  41. // Support both ng-repeat and static content
  42. if (hasNgRepeat) {
  43. children.addClass('md-fab-action-item');
  44. } else {
  45. // Wrap every child in a new div and add a class that we can scale/fling independently
  46. children.wrap('<div class="md-fab-action-item">');
  47. }
  48. }
  49. }
  50. }
  51. })();
  52. ngmaterial.components.fabActions = angular.module("material.components.fabActions");