-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Surface synchronous approach for view components #8686
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
Conversation
Note for the record that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
The view component is invoked in a Razor file (for example, *Views/Home/Index.cshtml*) with: | ||
|
||
```cshtml | ||
@await Component.InvokeAsync(nameof(PriorityList), new { maxPriority = 4, isDone = true }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to show the VCTagHelper as an example here? It hides the fact it's going async
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes ... I'll do that ... and I'll say either do it this way or that way.
@pranavkm Updates made. |
``` | ||
|
||
Note: In order to use a View Component as a Tag Helper, you must register the assembly containing the View Component using the `@addTagHelper` directive. For example, if your View Component is in an assembly called "MyWebApp", add the following directive to the `_ViewImports.cshtml` file: | ||
Note: In order to use a View Component as a Tag Helper, you must register the assembly containing the View Component using the `@addTagHelper` directive. For example, if your view component is in an assembly called `MyWebApp`, add the following directive to the `_ViewImports.cshtml` file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In orderyou must- Let's be consistent all throughout with the casing of "view component".
- Italicize the file name.
- While you're in the file, make the Invoking a view component as a Tag Helper section display ONLY for 1.1+.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's be consistent all throughout with the casing of "view component".
That's what I was trying to do. It was lowercase everywhere.
I'll get these on the next commit. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to simplify the prep phrase + subordinate conjunction just like we did the other day on that other PR. Let's just go with "If ... blah blah blah" ... "for example" is overused and obvious.
The view component is invoked in a Razor file (for example, *Views/Home/Index.cshtml*) using one of the following approaches: | ||
|
||
* <xref:Microsoft.AspNetCore.Mvc.IViewComponentHelper> | ||
* [Tag Helper](xref:mvc/views/tag-helpers/intro) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it clear that the Tag Helper approach only works in 1.1+.
oh ... one more commit coming ... stand by ... |
op op op ... we have it. All good. I'll merge this when the build completes. |
Fixes #8553
cc: @spottedmahn