One button two templates problem


<template name="previewPlaceholder">
  <div class="well preview-placeholder"></div>
</template>


<template name="deleteImageButton">
      <button id="delete-image-button" class="btn btn-primary navbar-btn navbar-right">Löschen</button>
</template>


Template.previewPlaceholder.onCreated (function(){
  this.setEmptyPreview = new ReactiveVar(false);
});

Template.previewPlaceholder.helpers ({
  getSetEmptyPreview(){
    return Template.instance().setEmptyPreview.get();
  },
});

Template.deleteImageButton.events({
  
   "click #delete-image-button" (event, template){
   var currentArray = template.data.pictures;
   var currentSlot = template.data.slot;
   var currentCover = template.data.coverImg;
   if(currentCover == currentArray[currentSlot] ){
     currentArray[currentSlot] = null;
     Projects.update( { _id: template.data.projectId }, { $set: { 'pictures': currentArray }} );
     for (var i = 0; i < 5; i++) {
        if (currentArray[i] != null){
            Projects.update( { _id: template.data.projectId }, { $set: { 'coverImg': currentArray[i] }} );  
            return;
        }
     }
   } 
   else{
    currentArray[currentSlot] = null;
    Projects.update( { _id: template.data.projectId }, { $set: { 'pictures': currentArray }} );
   }
  
  },
  
});

Template.previewPlaceholder.events({
  
   "click #delete-image-button" (event){
     const target = event.target;
     console.log("hfjdhjdjdjd")
     Template.instance().setEmptyPreview.set(true);
   }
});

I have two templates but one button. The deleteImageButton.events works fine but i wanna use Template.instance().setEmptyPreview.set(true); too.

i cant put it into the deleteImageButton.events, getting the “error” undefined, this is normal.
Creating a new event with the same button doesnt work.

i hope u can understand my problem xd

One button should work with two templates :smiley: