Skip to content

Commit

Permalink
fix: partial should not include div.id = counter
Browse files Browse the repository at this point in the history
  • Loading branch information
egil committed Apr 30, 2024
1 parent acc8fd4 commit 4f19d7e
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions samples/MinimalHtmxorApp/Components/Pages/Counter.razor
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@
content, like these paragraph elements.
</p>

<HtmxPartial>
<div id="counter">
<div id="counter">
<HtmxPartial>
<p role="status">
Current count: @CurrentCount
</p>
<button class="btn btn-primary"
hx-put="/counter"
<button class="btn btn-primary"
hx-put="/counter"
hx-vals='{ "CurrentCount": @(CurrentCount) }'
hx-target="#counter"
@onput="IncrementCount">Click me</button>
</div>
</HtmxPartial>
hx-target="#counter"
@onput="IncrementCount">
Click me
</button>
</HtmxPartial>
</div>

@code {
[SupplyParameterFromForm]
Expand All @@ -33,7 +35,7 @@
// Access the HtmxContextEventArgs to control
// the response headers to the client.
// E.g.: args.Response.StatusCode(201);
CurrentCount++;
}
}

0 comments on commit 4f19d7e

Please sign in to comment.