Skip to content

TagHelperContext.GetChildContentAsync moved to TagHelperOutput #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
NTaylorMullen opened this issue Oct 22, 2015 · 1 comment
Open

Comments

@NTaylorMullen
Copy link

Due to the new TagHelper addition of Init used to setup your TagHelperContext and other related item bag info for executed children to consume we decided that the ability to execute children doesn't entirely make sense on the context object since it has no connection to the actual structure of the element.

The alternative would have been to make GetChildContentAsync throw when invoked within the Init method (yuck).

Before

public class CustomTagHelper : TagHelper
{
    public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
    {
        await context.GetChildContentAsync();
    }
}

After

public class CustomTagHelper : TagHelper
{
    public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
    {
        await output.GetChildContentAsync();
    }
}
@aspnet aspnet locked and limited conversation to collaborators Oct 22, 2015
@NTaylorMullen
Copy link
Author

For discussion and feedback, please see the related discussion issue aspnet/Razor#583.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant