-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Support IsIndexer for ViewComponentTagHelpers #5207
Comments
For some context: This will enable users to more easily set Dictionary parameters passed to ViewComponents. Example: public class SomeViewComponent : ViewComponent
{
public IViewComponentResult Invoke(Dictionary<string, int> values)
{
return View()
}
} With what we have today you can only do the following to invoke
After this issue is completed you will be able to do:
|
Moving to 1.2. |
Can you actually do this now (as of 1.1.0) - i.e render a view component in a razor page using taghelper syntax:
Because I just gave that a go but no joy - also couldn't see any docs on this. |
@dazinator yes you can. Ensure you have |
Hmm... I can't appear to get this working - but I am wondering - could this be effected by me using a custom Basically in my ViewImports.cshtml file I have:
My VC is in an assembly `Gluon.Module.SomeModule.dll so it get's matched by my addTagHelper directive. As standard, addTagHelper directives don't let you use glob pattern matching on the assembly name portion of the directive, so to enable that I had to write this custom
There is a I register this on startup:
This I'll give it a go in a vanilla project to see if I can work out what the issue might be! |
Ya your custom |
Doh! |
I am trying to use the ViewComponents I have as tag helpers and get the intellisense working just fine but it isnt rendered when I preview running from VS2015. Any changes you need to make to get them working as taghelpers?!? I am running 1.1.0 and have the @addTagHelper in _Viewimports. Just noticed that optional parameters is not supported yet and I have those in most of my viewcomponents so I have to wait I guess. Sorry for not checking all outstanding issues before commenting. |
@johanskoldekrans if you're still having an issue please file a new issue and we will take a look. Thanks! |
@Eilon isnt optional parameters an open issue with 1.1? |
@johanskoldekrans that's something we're looking to support in 2.0, please see this issue: #5541 |
@Eilon thats why I updated my initial comment. 😊 Keep up the good work |
After #5189 is merged, view component descriptors can be changed to tag helper descriptors. However, the tag helper descriptors will have
IsIndexer
set to false.The text was updated successfully, but these errors were encountered: