Last active
July 14, 2017 10:09
-
-
Save josephwoodward/7bc9f76c471078efda93b16f63ae4a23 to your computer and use it in GitHub Desktop.
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
[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
Allows you to use:
instead of