Permalink
Browse files

setting title and child content on counter component

  • Loading branch information...
lusocoding committed Jan 22, 2019
1 parent 7236649 commit f27aa81c01a69aa0e6baf47dacbac1001bf9c30d
Showing with 17 additions and 7 deletions.
  1. +13 −7 WasmWithBlazorApp/Pages/Counter.cshtml
  2. +4 −0 WasmWithBlazorApp/Pages/Index.cshtml
@@ -1,17 +1,23 @@
@page "/counter"
@page "/anothercounter"

<h1>Counter</h1>

<h1>@Title</h1>
<p>@ChildContent</p>
<p>Current count: @currentCount</p>

<button class="btn btn-primary" onclick="@IncrementCount">Click me</button>

@functions {
int currentCount = 0;
[Parameter]
private string Title { get; set; } = "Navigation Counter";

void IncrementCount()
{
currentCount++;
}
[Parameter]
private RenderFragment ChildContent { get; set; }

int currentCount = 0;

void IncrementCount()
{
currentCount++;
}
}
@@ -5,3 +5,7 @@
Welcome to your new app.

<SurveyPrompt Title="How is Blazor working for you?" />

<Counter Title="Index Counter">
This counter is being displayed on the Index component.
</Counter>

0 comments on commit f27aa81

Please sign in to comment.