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