. 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...