I'm calling a part of a table from a razor component to a component that can be viewed. But the the problem is that there is an audio element i want to separate so it can be called at a different place.
Right now the audio element is included in the call in the loop. Is there any way the audio element can be separated in the CallComponent.razor, such that it can be called at a different loaction in index.razor?
Here is some code:
Index.razor
//I want to call the separated audio element here
...
<tbody>
@foreach (var fileGroup in GroupedAndSorted)
{
<CallComponent fileGroup="fileGroup" />
}
</tbody>
...
CallComponent.razor
<audio src="@audioUrl" controls>
</audio>
<tr>
<td>
<a @onclick="@(() => PlayAudio(Mp3.Url))"
class="link-primary"
role="button">
@fileGroup.Key
</a>
</td>
</tr>
...