Skip to content
This repository was archived by the owner on Dec 19, 2018. It is now read-only.
This repository was archived by the owner on Dec 19, 2018. It is now read-only.

Add TagHelperContext.Items bag to enable passing values between related tag helpers #238

@DamianEdwards

Description

@DamianEdwards

Add a new property public IDictionary<string, object> Items { get; } to the TagHelperContext class to facilitate the passing of arbitrary items between Tag Helpers running on the same element.

e.g.

[HtmlElementName("my-tag")]
public class MyTagHelper : TagHelper {
    public override void Process(TagHelperContext context, TagHelperOutput output) {
        context.Items["message"] = "This came from the MyTagHelper class!";
    }
}

[HtmlElementName("my-tag")]
public class MyOtherTagHelper : TagHelper {
    public override void Process(TagHelperContext context, TagHelperOutput output) {
        var message = context.Items["message"];
    }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions