Skip to content

Commit

Permalink
Merge branch '2.3'
Browse files Browse the repository at this point in the history
Former-commit-id: 8ba66e6
  • Loading branch information
andrey-skl committed Mar 30, 2016
2 parents 9c75bd7 + 91df407 commit 54189c3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions components/dialog-ng/dialog-ng.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ class DialogController {
if (shortcuts.getScope().indexOf(this.dialogService.DIALOG_NAMESPACE) > -1) {
shortcuts.setScope(this.currentShortcutsScope);
}

this.$scope.$broadcast('dialog.hide');
}

done() {
Expand Down Expand Up @@ -478,6 +480,9 @@ function rgDialogTitleDirective() {
function rgDialogContentDirective($compile) {
return {
link: function (scope, iElement) {
const element = iElement[0];
let contentScope;

function createIncludeNode() {
const node = document.createElement('ng-include');
node.setAttribute('src', 'dialog.content');
Expand All @@ -496,16 +501,19 @@ function rgDialogContentDirective($compile) {
return node;
}

let contentScope;
scope.$on('dialog.show', () => {
const element = iElement[0];

function destroy() {
if (contentScope) {
contentScope.$destroy();
while (element.childNodes.length) {
element.removeChild(element.childNodes[0]);
}
}
}

scope.$on('dialog.hide', destroy);

scope.$on('dialog.show', () => {
destroy();

const newContentNode = createContentNode();
element.appendChild(newContentNode);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
"babel-loader": "5.3.2",
"babel-runtime": "5.8.34-jb",
"classnames": "2.1.3",
"combokeys": "2.4.4",
"combokeys": "2.4.6",
"core-js": "1.1.4",
"css-loader": "0.12.0",
"dom4": "1.4.6",
Expand Down

0 comments on commit 54189c3

Please sign in to comment.