90 likes | 535 Views
#28 #. Tag Helpers. Design by: TEDU Trainer: Bach Ngoc Toan Website: www.tedu.com.vn Facebook: fb.com/ teduchannel. Please like videos and subscribe TEDU Channel to following the next video. Tag Helpers.
E N D
#28# Tag Helpers Design by: TEDU Trainer: Bach Ngoc Toan Website: www.tedu.com.vn Facebook: fb.com/teduchannel Please likevideos and subscribe TEDU Channel to following the next video.
Tag Helpers • Tag Helpers are new features in ASP.NET Core, which help us add the server side code easily into our HTML markup. • They look just like standard HTML code but it is processed by Razor engine on the server giving it all the advantageous of server-side rendering. • They manipulate the HTML elements on which they are operated or insert new HTML element, or replace the existing content with the new one.
Using Tag Helper • Microsoft.AspNetCore.Mvc.TagHelpers • @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers • _ViewImports.cshtml • @removeTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers“ • @addTagHelper "Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper, Microsoft.AspNetCore.Mvc.TagHelpers“ • @tagHelperPrefix th:
Example • <form asp-action="create" asp-controller="home"> • <form action="/home/create" method="post">
Advantages of Tag Helpers • An HTML-friendly development experience • A Rich IntelliSense Help • Cleaner Code • Extensible