mirror of
https://github.com/nasa/openmct.git
synced 2025-01-06 05:14:13 +00:00
parent
ec56fe7bfd
commit
a45dfc3822
@ -92,10 +92,19 @@ define(
|
|||||||
var activeElement = element,
|
var activeElement = element,
|
||||||
activeTemplateUrl,
|
activeTemplateUrl,
|
||||||
comment = this.$compile('<!-- hidden mct element -->')(scope),
|
comment = this.$compile('<!-- hidden mct element -->')(scope),
|
||||||
|
activeScope,
|
||||||
self = this;
|
self = this;
|
||||||
|
|
||||||
|
function destroyScope() {
|
||||||
|
if (activeScope) {
|
||||||
|
activeScope.$destroy();
|
||||||
|
activeScope = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function removeElement() {
|
function removeElement() {
|
||||||
if (activeElement !== comment) {
|
if (activeElement !== comment) {
|
||||||
|
destroyScope();
|
||||||
activeElement.replaceWith(comment);
|
activeElement.replaceWith(comment);
|
||||||
activeElement = comment;
|
activeElement = comment;
|
||||||
}
|
}
|
||||||
@ -110,8 +119,10 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function populateElement(template) {
|
function populateElement(template) {
|
||||||
|
destroyScope();
|
||||||
|
activeScope = scope.$new(false);
|
||||||
element.empty();
|
element.empty();
|
||||||
element.append(self.$compile(template)(scope));
|
element.append(self.$compile(template)(activeScope));
|
||||||
}
|
}
|
||||||
|
|
||||||
function badTemplate(templateUrl) {
|
function badTemplate(templateUrl) {
|
||||||
|
Loading…
Reference in New Issue
Block a user