UNPKG

landers.angular

Version:

landers.angular

34 lines (32 loc) 1.41 kB
;angular.module('Landers.angular') .provider('Dialog', function(){ var provider = this; this.skin = 'ulan'; this.defaults = { effect : 'random' }; this.$get = ['$compile', '$timeout', function($compile, $timeout) { return { confirm:function(scope, opts, callbacks){ callbacks = callbacks || {}; callbacks.yesFn = callbacks.yesFn || function () {}; callbacks.noFn = callbacks.noFn || function () {}; angular.extend(opts, { top : '30%', yes: {text:' 确定 ', fn:callbacks.yesFn }, no: {text:' 取消 ', fn:callbacks.noFn }, blur: false, angular : {compile:$compile, scope:scope, timeout:$timeout} }); return Landers.dialog.show(opts); }, show:function(scope, opts){ var extOpts = opts.compile === false ? {} : { angular : {compile:$compile, scope:scope, timeout:$timeout}, }; opts = angular.extend({}, provider.defaults, extOpts, opts); return Landers.dialog.show(opts, provider.skin); } }; }]; });