Open leotsarev opened 4 years ago
Sample code:
[HtmlTargetElement("button")]
public class ConditionalDisableTagHelper : TagHelper
{
[HtmlAttributeName("asp-is-disabled")]
public bool IsDisabled { set; get; }
public override void Process(TagHelperContext context, TagHelperOutput output)
{
if (IsDisabled)
{
var d = new TagHelperAttribute("disabled", "disabled");
output.Attributes.Add(d);
}
base.Process(context, output);
}
}
In particular, please add
[MeansImplicitUse]
toHtmlTargetElement
andHtmlAttributeName