Skip to content

Commit da23578

Browse files
committed
upgrade version to 0.0.14 , scope destroy
1 parent d6b7957 commit da23578

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-wtpbox",
3-
"version": "0.0.13",
3+
"version": "0.0.14",
44
"main": "src/pbox.js",
55
"dependencies": {
66
"angular": "~1.2.25",

src/pbox.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -150,23 +150,23 @@
150150
.provider("$pbox", [function () {
151151
// The default options for all popboxs.
152152
var defaultOptions = {
153-
placement : 'bottom',
154-
align : null, //居什么对齐 left,right,bottom,top
155-
animation : false,//是否有动画
156-
delay : 0, //延迟多长时间弹出
157-
arrow : false,
158-
openClass : 'pbox-open',
153+
placement: 'bottom',
154+
align: null, //居什么对齐 left,right,bottom,top
155+
animation: false,//是否有动画
156+
delay: 0, //延迟多长时间弹出
157+
arrow: false,
158+
openClass: 'pbox-open',
159159
closeClass: 'pbox-close',
160-
autoClose : true, //点击其他区域自动关闭,当点击触发弹出框的元素或者弹出框内部元素时不关闭,
160+
autoClose: true, //点击其他区域自动关闭,当点击触发弹出框的元素或者弹出框内部元素时不关闭,
161161
forceClose: false,//autoClose为true时起作用,点击触发弹出框的元素也关闭
162-
offset : 1, //位移位置
163-
autoAdapt : true, //是否自动计算上下,左右的高度或者宽度,当 placement 为 bottom,top的时候为true,自动调整 placement
164-
watch : false,//watch 弹出框的宽高,当有变化的时候重新计算位置
165-
resolve : {}
162+
offset: 1, //位移位置
163+
autoAdapt: true, //是否自动计算上下,左右的高度或者宽度,当 placement 为 bottom,top的时候为true,自动调整 placement
164+
watch: false,//watch 弹出框的宽高,当有变化的时候重新计算位置
165+
resolve: {}
166166
};
167167

168168
var globalOptions = {
169-
triggerClass : "pbox-trigger",
169+
triggerClass: "pbox-trigger",
170170
boxInstanceName: "boxInstance"
171171
};
172172

@@ -175,7 +175,7 @@
175175
};
176176

177177
var util = {
178-
hasClass : function (element, className) {
178+
hasClass: function (element, className) {
179179
return element.hasClass(className) || element.parents("." + className).length > 0;
180180
},
181181
hasClasses: function (element, classes) {
@@ -188,7 +188,7 @@
188188
});
189189
return result;
190190
},
191-
getTarget : function (event) {
191+
getTarget: function (event) {
192192
var $target = angular.element(event.target);
193193
if (!$target) {
194194
throw new Error("The event")
@@ -290,6 +290,7 @@
290290
this._pboxElement = angular.element('<div class="pbox"></div>');
291291
this._pboxElement.html(tpl);
292292
this._$target.addClass(this._options.openClass);
293+
this._scope = scope;
293294
$compile(this._pboxElement)(scope);
294295
$body.append(this._pboxElement);
295296
$timeout(function () {
@@ -311,12 +312,14 @@
311312
BoxModal.prototype.close = function (result) {
312313
this._remove();
313314
this.$watch && this.$watch();
315+
this._scope && this._scope.$destroy();
314316
$document.unbind("mousedown.pbox" + this._id);
315317
_resultDeferred.resolve(result);
316318
};
317319

318320
BoxModal.prototype.dismiss = function (reason) {
319321
this._remove();
322+
this._scope && this._scope.$destroy();
320323
_resultDeferred.reject(reason);
321324
}
322325
}

0 commit comments

Comments
 (0)