Tag helpers #457
Replies: 2 comments 10 replies
-
Giraffe doesn't have something like tag helpers at the moment and I don't know of any project which adds that functionality to Giraffe, but it's certainly something which is possible. It would have to use reflection, but it shouldn't be too difficult for a function to accept a a model and the name of property and then do the magic. The only issue I think we won't get away (even with F# trickery) is the fact that one has to pass the name of the property as a "magic" string into such a function, but given that this is what the C# tag helper is doing as well the F# version wouldn't be any less good. |
Beta Was this translation helpful? Give feedback.
-
The source for the tag helpers that are built-in to ASP.NET Core: https://github.com/dotnet/aspnetcore/tree/master/src/Mvc/Mvc.TagHelpers/src It would be nice if we could use those from F#. :-) Asking in aspnetcore regarding the programmatic use of the existing tag helpers: |
Beta Was this translation helpful? Give feedback.
-
In a previous post, I mentioned MvcMovieGiraffe.
Here's a usage of the input tag helper from the C# version of that project:
It references the following member of the model:
If you look at source of the resulting page, that tag helper expands into:
Is there something like tag helpers for Giraffe? Either built-in or available as a library?
I messed around with putting together something like a tag helper (source). Example call:
That expands into:
Thanks for any suggestions!
Beta Was this translation helpful? Give feedback.
All reactions