|
|
@@ -58,11 +58,20 @@ export class GridCtrl {
|
|
|
}
|
|
|
|
|
|
bindItem(element) {
|
|
|
- this.gridstack.makeWidget(element);
|
|
|
+ if (this.gridstack) {
|
|
|
+ this.gridstack.makeWidget(element);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
removeItem(element) {
|
|
|
- this.gridstack.removeWidget(element, false);
|
|
|
+ if (this.gridstack) {
|
|
|
+ this.gridstack.removeWidget(element, false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ destroy() {
|
|
|
+ this.gridstack.destroy();
|
|
|
+ this.gridstack = null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -81,6 +90,10 @@ export function dashGrid($timeout) {
|
|
|
$timeout(function() {
|
|
|
ctrl.init();
|
|
|
});
|
|
|
+
|
|
|
+ scope.$on('$destroy', () => {
|
|
|
+ ctrl.destroy();
|
|
|
+ });
|
|
|
}
|
|
|
};
|
|
|
}
|