#1144 fixed bugs with $destroy

This commit is contained in:
Gerard 2019-02-15 11:03:27 +01:00
parent c3903b8d51
commit 90a4e5a7d1
2 changed files with 6 additions and 4 deletions

View File

@ -61,7 +61,8 @@ export default class Controller extends Component {
if (event.defaultPrevented) return;
event.preventDefault();
this.$panel = this.$compile(`<${this.panel}/>`)(this.$.$new());
this.$panelScope = this.$.$new();
this.$panel = this.$compile(`<${this.panel}/>`)(this.$panelScope);
let panel = this.$panel.isolateScope().$ctrl;
panel.filter = this._filter;
panel.onSubmit = filter => this.onPanelSubmit(filter);
@ -72,7 +73,7 @@ export default class Controller extends Component {
}
onPopoverClose() {
this.$panel.scope().$destroy();
this.$panelScope.$destroy();
this.$panel.remove();
this.$panel = null;
}

View File

@ -136,7 +136,8 @@ class Controller {
if (event.defaultPrevented) return;
event.preventDefault();
this.$panel = this.$compile(`<vn-order-catalog-search-panel/>`)(this.$scope.$new());
this.$panelScope = this.$scope.$new();
this.$panel = this.$compile(`<vn-order-catalog-search-panel/>`)(this.$panelScope);
const panel = this.$panel.isolateScope().$ctrl;
panel.filter = this.filter;
panel.onSubmit = filter => this.onPanelSubmit(filter);
@ -153,7 +154,7 @@ class Controller {
}
onPopoverClose() {
this.$panel.scope().$destroy();
this.$panelScope.$destroy();
this.$panel.remove();
this.$panel = null;
}