Skip to content

Getting Started, cant get it working #24

Closed Answered by kjeske
mxmissile asked this question in Q&A
Discussion options

You must be logged in to vote

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";
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mxmissile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants