-
There is probably a basic concept I am missing, but clicking the Add Invoice button does nothing, followed the Getting Started guide, here is my view:
And here is my model:
The Add() method is not firing. hydro.js and alpine.js are being loaded. |
Beta Was this translation helpful? Give feedback.
Answered by
kjeske
May 8, 2024
Replies: 1 comment
-
Hi! Try to separate your page and the Hydro component: AddTest.cshtml.cs public class AddTest : HydroComponent
{
[SkipOutput]
public void Add()
{
throw new NotImplementedException();
//Location(Url.Page("/Invoices/Add"));
}
} AddTest.cshtml @model AddTest
<div>
<h1>hello world</h1>
<button class="btn btn-primary" hydro-on:click="@(() => Model.Add())">
<span class="loading loading-spinner loading-sm spinner" aria-hidden="true"></span>
Add invoice
</button>
</div> Index.cshtml.cs: public class IndexModel : PageModel
{
public void OnGet()
{
}
} Index.cshtml @page "/"
@model IndexModel
@{
Layout = "../UI/Layouts/MainLayout";
}
<hydro name="AddTest" /> |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
mxmissile
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! Try to separate your page and the Hydro component:
AddTest.cshtml.cs
AddTest.cshtml
Index.cshtml.cs:
Index.cshtml