'Passing data from controller to header in modal
Please help me..
I want to pass some text from controller to modal in header tag..
This is what I want to send to header at modal from controller's method:
$this->labelFormTambah = "Edit Data Donatur";
And this is the attribute of the header that I want to send the data above:
<h3 class="modal-title" id="labelFormTambah" wire:model="labelFormTambah">
Sadly that doesn't work.
Any data sent from the same method to the same modal in input tags, is perfectly working.
Where is my mistake?
Solution 1:[1]
I have a suggestion.
Your controller should look something like this:
public function edit(){
//since you know the value of $this->labelFormTambah you can just pass it as an argument instead of creating a variable name first
return view("edit.page",["lableForm" => "Edit Data Donatur"])
}
And then in your edit page your modal header should be like this:
<h3 class="modal-title" id="labelFormTambah" wire:model="labelFormTambah">{{$labelForm}}</h3> //the value in the double curly braces comes from the argument you've passed in your controller
And that will display your $this->lableFormTambah value that you returned along with your view as a value in your modal header tag
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Relcode |
