Created
September 1, 2020 15:26
-
-
Save conficient/5f335ef9418b5a1da6d3f7c1bdd4d6fb to your computer and use it in GitHub Desktop.
Loading content control for Razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* shows a loading gif/text if a value is null */ | |
@if (Value == null) | |
{ | |
<div><img src="/img/SmallLoader.gif" alt="loading" /> Loading</div> | |
} | |
else | |
{ | |
@ChildContent | |
} | |
@code { | |
[Parameter] public RenderFragment ChildContent { get; set; } | |
[Parameter] public object Value { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This gist is to replace all that boilderplate code like this:
Instead you can write