. NetCore ~ Use of TagHelpers label, coretaghelpers

Source: Internet
Author: User

. NetCore ~ Use of TagHelpers label, coretaghelpers

TagHelpers allows the server code to participate in the creation and rendering of HTML elements, so that the entire View only looks like Html code. It also allows front-end developers to directly use pages developed by front-end developers, without repeated code writing, this design will become the mainstream. The syntax is similar to KO and AngularJs. Simply add corresponding tags to Html elements. The following describes several main TagHelpers labels.

Inject TagHelpers Components

@ AddTagHelper *, Microsoft. AspNetCore. Mvc. TagHelpers // Injection

Remove the TagHelpers component

@ RemoveTagHelper *, Microsoft. AspNetCore. Mvc. TagHelpers // remove

The following describes several common Tag tags.

Asp-for is similar to name

Asp-validation-for is similar to the validation in mvc, and the verification comes from the verification feature of the model.

Asp-validation-summary check information for each label

Controller in asp-controller specified route

Asp-action specifies the action in the route

Asp-route-id: assign a value to the id parameter in the route

Environment object. Different code segments can be referenced in the development and production environments.

This article describes how to use the tagHelper tag. Thank you for reading. Net Core. Let's continue...

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.