angular-cached-resource
Version:
An AngularJS module to interact with RESTful resources, even when browser is offline
8 lines • 1.42 kB
JavaScript
/**
* angular-strap
* @version v2.0.1 - 2014-04-10
* @link http://mgcrea.github.io/angular-strap
* @author Olivier Louvignes (olivier@mg-crea.com)
* @license MIT License, http://www.opensource.org/licenses/MIT
*/
;angular.module("mgcrea.ngStrap.alert",["mgcrea.ngStrap.modal"]).provider("$alert",function(){var t=this.defaults={animation:"am-fade",prefixClass:"alert",placement:null,template:"alert/alert.tpl.html",container:!1,element:null,backdrop:!1,keyboard:!0,show:!0,duration:!1,type:!1};this.$get=["$modal","$timeout",function(e,n){function a(a){var r={},o=angular.extend({},t,a);r=e(o),o.type&&(r.$scope.type=o.type);var i=r.show;return o.duration&&(r.show=function(){i(),n(function(){r.hide()},1e3*o.duration)}),r}return a}]}).directive("bsAlert",["$window","$location","$sce","$alert",function(t,e,n,a){t.requestAnimationFrame||t.setTimeout;return{restrict:"EAC",scope:!0,link:function(t,e,r){var o={scope:t,element:e,show:!1};angular.forEach(["template","placement","keyboard","html","container","animation","duration"],function(t){angular.isDefined(r[t])&&(o[t]=r[t])}),angular.forEach(["title","content","type"],function(e){r[e]&&r.$observe(e,function(a){t[e]=n.trustAsHtml(a)})}),r.bsAlert&&t.$watch(r.bsAlert,function(e){angular.isObject(e)?angular.extend(t,e):t.content=e},!0);var i=a(o);e.on(r.trigger||"click",i.toggle),t.$on("$destroy",function(){i.destroy(),o=null,i=null})}}}]);