Skip to content

Commit

Permalink
Add IF THEN ELSE example
Browse files Browse the repository at this point in the history
  • Loading branch information
mrpmorris authored Jul 6, 2022
1 parent 01ef369 commit f417a99
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,40 @@ You can write this
</If>
```

Instead of this
```
@if (People?.Length > 0)
{
<ol>
@foreach (var person in People)
{
<li>@person.FullName</li>
}
</ol>
}
else
{
<p>No people found</p>
}
```

You can write this

```
<If Condition="People?.Length > 0">
<Then>
<ol>
<ForEach Context=person In=People>
<li>@person.FullName</li>
</ForEach>
</ol>
</Then>
<Else>
<p>No people found</p>
</Else>
</If>
```

## More information
- View the [Example projects](https://github.com/mrpmorris/Morris.Blazor.ControlFlow/tree/master/Source/Tutorials)
- Read the [Release notes](https://github.com/mrpmorris/Morris.Blazor.ControlFlow/blob/master/Docs/Releases.md)
- Read the [Release notes](https://github.com/mrpmorris/Morris.Blazor.ControlFlow/blob/master/Docs/Releases.md)

0 comments on commit f417a99

Please sign in to comment.