Programmatic use of tag helpers #28648
Unanswered
dharmatech
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Background
Giraffe is an F# web framework built on ASP.NET Core.
mvc-movie-giraffe is a port of the MvcMovie project from the ASP.NET Core documentation to F#/Giraffe.
The C# version of MvcMovie demonstrates the use of tag helpers. Giraffe doesn't yet have any equivalent of tag helpers, so I've started to look into rolling my own version of a few of them.
Example
The
Movie
class of the original C# project has the following property:Here the input tag helper is being used in the C# version of the edit view:
It expands into:
I have a minimal F# version of the
input
tag helper inTagHelpers.fs
.Example of calling it:
That expands into:
Question
It would be really nice if users of Giraffe could benefit from all the tag helpers that are already provided by ASP.NET Core.
Is there a way to programmatically use the tag helpers directly from C# or F# instead of implicitly from a
cshtml
view file?Thanks for any suggestions!
Beta Was this translation helpful? Give feedback.
All reactions