Assign the tag list (taghelper) to the parent tag

I need to achieve as shown below

<MyTagList>
    <MyTag></MyTag>
    <MyTag></MyTag>
</MyTagList>

      

When I use MyTag

during development it should be automatically enclosed in MyTagList

or MyTag

if the error should be enclosed inMyTagList

+1


source to share


1 answer


You cannot do this today during development. However, you can do this partially at runtime using TagHelperContext.Items

. By using the property Items

, you can make sure each tag is wrapped in a parent tag and throws it away if it isn't. Insert the indicator into the package Items

in the parent and make sure it exists in the children.

As for supporting this in the future, there are two issues that could be added to support development time:



Hope this helps!

+1


source







All Articles