toast.min.js 2.0 KB

1234567
  1. /*!
  2. * Angular Material Design
  3. * https://github.com/angular/material
  4. * @license MIT
  5. * v0.11.3-master-3fe7d76
  6. */
  7. !function(t,n,e){"use strict";function o(t){return{restrict:"E",link:function(n,e,o){n.$on("$destroy",function(){t.destroy()})}}}function i(t){function n(t,n,o){function i(i,a,c){return e=c.content,a=o.extractElementByName(a,"md-toast",!0),c.onSwipe=function(t,e){a.addClass("md-"+t.type.replace("$md.","")),o.nextTick(n.cancel)},c.openClass=s(c.position),c.parent.addClass(c.openClass),a.on(r,c.onSwipe),a.addClass(c.position.split(" ").map(function(t){return"md-"+t}).join(" ")),t.enter(a,c.parent)}function a(n,e,o){return e.off(r,o.onSwipe),o.parent.removeClass(o.openClass),1==o.$destroy?e.remove():t.leave(e)}function s(t){return"md-toast-open-"+(t.indexOf("top")>-1?"top":"bottom")}var r="$md.swipeleft $md.swiperight";return{onShow:i,onRemove:a,position:"bottom left",themable:!0,hideDelay:3e3}}var e,o="ok",i=t("$mdToast").setDefaults({methods:["position","hideDelay","capsule","parent"],options:n}).addPreset("simple",{argOption:"content",methods:["content","action","highlightAction","theme","parent"],options:["$mdToast","$mdTheming",function(t,n){var i={template:['<md-toast md-theme="{{ toast.theme }}" ng-class="{\'md-capsule\': toast.capsule}">',"<span flex>{{ toast.content }}</span>",'<md-button class="md-action" ng-if="toast.action" ng-click="toast.resolve()" ng-class="{\'md-highlight\': toast.highlightAction}">',"{{ toast.action }}","</md-button>","</md-toast>"].join(""),controller:["$scope",function(n){var i=this;n.$watch(function(){return e},function(){i.content=e}),this.resolve=function(){t.hide(o)}}],theme:n.defaultTheme(),controllerAs:"toast",bindToController:!0};return i}]}).addMethod("updateContent",function(t){e=t});return n.$inject=["$animate","$mdToast","$mdUtil"],i}n.module("material.components.toast",["material.core","material.components.button"]).directive("mdToast",o).provider("$mdToast",i),o.$inject=["$mdToast"],i.$inject=["$$interimElementProvider"]}(window,window.angular);