0

I'm trying to create a separate component to open a modal, but my events are not getting fired.

My parent component is Admin, and the component to open a modal is AddVideo

here is my Admin Component

public function add() 
{
    $this->emit('addvideoModal');
 
}

This is the button to fire that method

   <x-jet-button wire:click="add">
           {{ __('+ Video') }}
   </x-jet-button>
   

This is from the AddVideoModal

class AddVideo extends Component
{        
    protected $listeners = ['addvideoModal' => 'render'];

    public function render()
     {  
         return view('livewire.add-video');
     }
}

*Note, all my components are enclosed in a single Element. Am I missing something here?

Any help would be greatly appreciated.

PendejoTrax
  • 170
  • 3
  • 15

1 Answers1

1

apparently need to create a new method.

protected $listeners = ['addvideoModal' => 'sample'];

public function sample()
{
    $this->addModal = true;
}
PendejoTrax
  • 170
  • 3
  • 15