` if one is not provided. Defaults to true. Can be disabled if you provide a\r\n * custom toast directive.\r\n * - `scope` - `{object=}`: the scope to link the template / controller to. If none is specified, it will create a new child scope.\r\n * This scope will be destroyed when the toast is removed unless `preserveScope` is set to true.\r\n * - `preserveScope` - `{boolean=}`: whether to preserve the scope when the element is removed. Default is false\r\n * - `hideDelay` - `{number=}`: How many milliseconds the toast should stay\r\n * active before automatically closing. Set to 0 or false to have the toast stay open until\r\n * closed manually. Default: 3000.\r\n * - `position` - `{string=}`: Sets the position of the toast.
\r\n * Available: any combination of `'bottom'`, `'left'`, `'top'`, `'right'`, `'end'` and `'start'`.\r\n * The properties `'end'` and `'start'` are dynamic and can be used for RTL support.
\r\n * Default combination: `'bottom left'`.\r\n * - `toastClass` - `{string=}`: A class to set on the toast element.\r\n * - `controller` - `{string=}`: The controller to associate with this toast.\r\n * The controller will be injected the local `$mdToast.hide( )`, which is a function\r\n * used to hide the toast.\r\n * - `locals` - `{string=}`: An object containing key/value pairs. The keys will\r\n * be used as names of values to inject into the controller. For example,\r\n * `locals: {three: 3}` would inject `three` into the controller with the value\r\n * of 3.\r\n * - `bindToController` - `bool`: bind the locals to the controller, instead of passing them in.\r\n * - `resolve` - `{object=}`: Similar to locals, except it takes promises as values\r\n * and the toast will not open until the promises resolve.\r\n * - `controllerAs` - `{string=}`: An alias to assign the controller to on the scope.\r\n * - `parent` - `{element=}`: The element to append the toast to. Defaults to appending\r\n * to the root element of the application.\r\n *\r\n * @returns {promise} A promise that can be resolved with `$mdToast.hide()` or\r\n * rejected with `$mdToast.cancel()`. `$mdToast.hide()` will resolve either with a Boolean\r\n * value == 'true' or the value passed as an argument to `$mdToast.hide()`.\r\n * And `$mdToast.cancel()` will resolve the promise with a Boolean value == 'false'\r\n */\r\n\r\n/**\r\n * @ngdoc method\r\n * @name $mdToast#hide\r\n *\r\n * @description\r\n * Hide an existing toast and resolve the promise returned from `$mdToast.show()`.\r\n *\r\n * @param {*=} response An argument for the resolved promise.\r\n *\r\n * @returns {promise} a promise that is called when the existing element is removed from the DOM.\r\n * The promise is resolved with either a Boolean value == 'true' or the value passed as the\r\n * argument to `.hide()`.\r\n *\r\n */\r\n\r\n/**\r\n * @ngdoc method\r\n * @name $mdToast#cancel\r\n *\r\n * @description\r\n * `DEPRECATED` - The promise returned from opening a toast is used only to notify about the closing of the toast.\r\n * As such, there isn't any reason to also allow that promise to be rejected,\r\n * since it's not clear what the difference between resolve and reject would be.\r\n *\r\n * Hide the existing toast and reject the promise returned from\r\n * `$mdToast.show()`.\r\n *\r\n * @param {*=} response An argument for the rejected promise.\r\n *\r\n * @returns {promise} a promise that is called when the existing element is removed from the DOM\r\n * The promise is resolved with a Boolean value == 'false'.\r\n *\r\n */\r\n\r\nfunction MdToastProvider($$interimElementProvider) {\r\n // Differentiate promise resolves: hide timeout (value == true) and hide action clicks (value == ok).\r\n MdToastController.$inject = [\"$mdToast\", \"$scope\"];\r\n toastDefaultOptions.$inject = [\"$animate\", \"$mdToast\", \"$mdUtil\", \"$mdMedia\"];\r\n var ACTION_RESOLVE = 'ok';\r\n\r\n var activeToastContent;\r\n var $mdToast = $$interimElementProvider('$mdToast')\r\n .setDefaults({\r\n methods: ['position', 'hideDelay', 'capsule', 'parent', 'position', 'toastClass'],\r\n options: toastDefaultOptions\r\n })\r\n .addPreset('simple', {\r\n argOption: 'textContent',\r\n methods: ['textContent', 'content', 'action', 'highlightAction', 'highlightClass', 'theme', 'parent' ],\r\n options: /* @ngInject */ [\"$mdToast\", \"$mdTheming\", function($mdToast, $mdTheming) {\r\n return {\r\n template:\r\n '
' +\r\n ' ' +\r\n ' ' +\r\n ' {{ toast.content }}' +\r\n ' ' +\r\n ' ' +\r\n ' {{ toast.action }}' +\r\n ' ' +\r\n '
' +\r\n '',\r\n controller: MdToastController,\r\n theme: $mdTheming.defaultTheme(),\r\n controllerAs: 'toast',\r\n bindToController: true\r\n };\r\n }]\r\n })\r\n .addMethod('updateTextContent', updateTextContent)\r\n .addMethod('updateContent', updateTextContent);\r\n\r\n function updateTextContent(newContent) {\r\n activeToastContent = newContent;\r\n }\r\n\r\n return $mdToast;\r\n\r\n /**\r\n * Controller for the Toast interim elements.\r\n * @ngInject\r\n */\r\n function MdToastController($mdToast, $scope) {\r\n // For compatibility with AngularJS 1.6+, we should always use the $onInit hook in\r\n // interimElements. The $mdCompiler simulates the $onInit hook for all versions.\r\n this.$onInit = function() {\r\n var self = this;\r\n\r\n if (self.highlightAction) {\r\n $scope.highlightClasses = [\r\n 'md-highlight',\r\n self.highlightClass\r\n ];\r\n }\r\n\r\n $scope.$watch(function() { return activeToastContent; }, function() {\r\n self.content = activeToastContent;\r\n });\r\n\r\n this.resolve = function() {\r\n $mdToast.hide( ACTION_RESOLVE );\r\n };\r\n };\r\n }\r\n\r\n /* @ngInject */\r\n function toastDefaultOptions($animate, $mdToast, $mdUtil, $mdMedia) {\r\n var SWIPE_EVENTS = '$md.swipeleft $md.swiperight $md.swipeup $md.swipedown';\r\n return {\r\n onShow: onShow,\r\n onRemove: onRemove,\r\n toastClass: '',\r\n position: 'bottom left',\r\n themable: true,\r\n hideDelay: 3000,\r\n autoWrap: true,\r\n transformTemplate: function(template, options) {\r\n var shouldAddWrapper = options.autoWrap && template && !/md-toast-content/g.test(template);\r\n\r\n if (shouldAddWrapper) {\r\n // Root element of template will be
. We need to wrap all of its content inside of\r\n // of . All templates provided here should be static, developer-controlled\r\n // content (meaning we're not attempting to guard against XSS).\r\n var templateRoot = document.createElement('md-template');\r\n templateRoot.innerHTML = template;\r\n\r\n // Iterate through all root children, to detect possible md-toast directives.\r\n for (var i = 0; i < templateRoot.children.length; i++) {\r\n if (templateRoot.children[i].nodeName === 'MD-TOAST') {\r\n var wrapper = angular.element('
');\r\n\r\n // Wrap the children of the `md-toast` directive in jqLite, to be able to append multiple\r\n // nodes with the same execution.\r\n wrapper.append(angular.element(templateRoot.children[i].childNodes));\r\n\r\n // Append the new wrapped element to the `md-toast` directive.\r\n templateRoot.children[i].appendChild(wrapper[0]);\r\n }\r\n }\r\n\r\n // We have to return the innerHTMl, because we do not want to have the `md-template` element to be\r\n // the root element of our interimElement.\r\n return templateRoot.innerHTML;\r\n }\r\n\r\n return template || '';\r\n }\r\n };\r\n\r\n function onShow(scope, element, options) {\r\n activeToastContent = options.textContent || options.content; // support deprecated #content method\r\n\r\n var isSmScreen = !$mdMedia('gt-sm');\r\n\r\n element = $mdUtil.extractElementByName(element, 'md-toast', true);\r\n options.element = element;\r\n\r\n options.onSwipe = function(ev, gesture) {\r\n //Add the relevant swipe class to the element so it can animate correctly\r\n var swipe = ev.type.replace('$md.','');\r\n var direction = swipe.replace('swipe', '');\r\n\r\n // If the swipe direction is down/up but the toast came from top/bottom don't fade away\r\n // Unless the screen is small, then the toast always on bottom\r\n if ((direction === 'down' && options.position.indexOf('top') != -1 && !isSmScreen) ||\r\n (direction === 'up' && (options.position.indexOf('bottom') != -1 || isSmScreen))) {\r\n return;\r\n }\r\n\r\n if ((direction === 'left' || direction === 'right') && isSmScreen) {\r\n return;\r\n }\r\n\r\n element.addClass('md-' + swipe);\r\n $mdUtil.nextTick($mdToast.cancel);\r\n };\r\n options.openClass = toastOpenClass(options.position);\r\n\r\n element.addClass(options.toastClass);\r\n\r\n // 'top left' -> 'md-top md-left'\r\n options.parent.addClass(options.openClass);\r\n\r\n // static is the default position\r\n if ($mdUtil.hasComputedStyle(options.parent, 'position', 'static')) {\r\n options.parent.css('position', 'relative');\r\n }\r\n\r\n element.on(SWIPE_EVENTS, options.onSwipe);\r\n element.addClass(isSmScreen ? 'md-bottom' : options.position.split(' ').map(function(pos) {\r\n return 'md-' + pos;\r\n }).join(' '));\r\n\r\n if (options.parent) options.parent.addClass('md-toast-animating');\r\n return $animate.enter(element, options.parent).then(function() {\r\n if (options.parent) options.parent.removeClass('md-toast-animating');\r\n });\r\n }\r\n\r\n function onRemove(scope, element, options) {\r\n element.off(SWIPE_EVENTS, options.onSwipe);\r\n if (options.parent) options.parent.addClass('md-toast-animating');\r\n if (options.openClass) options.parent.removeClass(options.openClass);\r\n\r\n return ((options.$destroy == true) ? element.remove() : $animate.leave(element))\r\n .then(function () {\r\n if (options.parent) options.parent.removeClass('md-toast-animating');\r\n if ($mdUtil.hasComputedStyle(options.parent, 'position', 'static')) {\r\n options.parent.css('position', '');\r\n }\r\n });\r\n }\r\n\r\n function toastOpenClass(position) {\r\n // For mobile, always open full-width on bottom\r\n if (!$mdMedia('gt-xs')) {\r\n return 'md-toast-open-bottom';\r\n }\r\n\r\n return 'md-toast-open-' +\r\n (position.indexOf('top') > -1 ? 'top' : 'bottom');\r\n }\r\n }\r\n\r\n}\r\n\r\n})();\r\n(function(){\r\n\"use strict\";\r\n\r\n/**\r\n * @ngdoc module\r\n * @name material.components.toolbar\r\n */\r\nmdToolbarDirective.$inject = [\"$$rAF\", \"$mdConstant\", \"$mdUtil\", \"$mdTheming\", \"$animate\"];\r\nangular.module('material.components.toolbar', [\r\n 'material.core',\r\n 'material.components.content'\r\n])\r\n .directive('mdToolbar', mdToolbarDirective);\r\n\r\n/**\r\n * @ngdoc directive\r\n * @name mdToolbar\r\n * @module material.components.toolbar\r\n * @restrict E\r\n * @description\r\n * `md-toolbar` is used to place a toolbar in your app.\r\n *\r\n * Toolbars are usually used above a content area to display the title of the\r\n * current page, and show relevant action buttons for that page.\r\n *\r\n * You can change the height of the toolbar by adding either the\r\n * `md-medium-tall` or `md-tall` class to the toolbar.\r\n *\r\n * @usage\r\n *
\r\n * \r\n *