Last active
December 7, 2019 20:43
-
-
Save muratbaseren/1edb6723d928119864f06117debf18eb to your computer and use it in GitHub Desktop.
Tag Helper PreElement PostElement Kullanımı
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
Tag Helper PreElement PostElement Kullanımı |
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("t1")] | |
public class T1TagHelper : TagHelper | |
{ | |
/* | |
* <span class='pre-el post-el'> | |
* <div class='t1'> | |
* <span class='pre-con post-con'></span> | |
* test t1 | |
* </div> | |
* </span> | |
*/ | |
public async override void Process(TagHelperContext context, TagHelperOutput output) | |
{ | |
output.TagName = "div"; | |
output.Attributes.SetAttribute("class", "t1"); | |
output.PreElement.AppendHtml("<span class='pre-el post-el'>"); | |
output.Content.Append("test t1"); | |
output.PreContent.AppendHtml("<span class='pre-con post-con'></span>"); | |
output.PostElement.AppendHtml("</span>"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment