-
-
Save rippo/8c2fb238ec1fbabe6d8606f98e8da1e7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
[HtmlTargetElement("div")] | |
public class VisibilityTagHelper : TagHelper | |
{ | |
public bool IsVisible { get; set; } = true; | |
public override void Process(TagHelperContext context, TagHelperOutput output) | |
{ | |
if (!IsVisible) | |
output.SuppressOutput(); | |
base.Process(context, output); | |
} | |
public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) | |
{ | |
if (!IsVisible) | |
output.SuppressOutput(); | |
return base.ProcessAsync(context, output); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment