Permalink
Browse files

[0.11.3] delete model-h2 endPoint when model is destroyed

  • Loading branch information...
dog-ears committed Feb 22, 2018
1 parent 8600c7e commit c7b772c2ec27c703829e99463e28028ab5118d44
Showing with 13 additions and 0 deletions.
  1. +5 −0 src/app/model/model.component.ts
  2. +8 −0 src/app/service/jsPlumb.service.ts
@@ -35,6 +35,11 @@ export class ModelComponent {
this.jsPlumbService.initModel(this.myModel);
}

ngOnDestroy(){
console.log('ModelComponent('+ this.myModel.id +').ngOnDestroy() is called!');
this.jsPlumbService.destroyModel(this.myModel);
}

private editModel():void{
console.log('ModelComponent('+ this.myModel.id +').editModel() is called!');
this.bsModalRef = this.bsModalService.show( ModalModelComponent, {initialState:{
@@ -60,6 +60,14 @@ export class JsPlumbService {
}
}

public destroyModel(model:Model){

//delete myself endpoint
this._instance.selectEndpoints({
source: model.getElementH2Id()
}).delete();
}

public toggleDraggable(model:Model): void{

console.log('JsPlumbService.toggleDraggable() is called!');

0 comments on commit c7b772c

Please sign in to comment.