-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Make it possible to reason about content to project (content projection and content queries unification) #37319
Comments
Here is one use case with the Angular Material lib : (ref for more info : angular/components#9411) The use case is to share some advanced form fields in an app (add features around a MatFormFieldControl) without reimplementing all the values of input The content projection is used to project the input into the advanced form field Rough example :
Full example here : https://stackblitz.com/edit/angular-material2-issue-jekywv Without this, all the values of the input used by my-component needs to be implemented by my-advanced-field resulting in large boilerplate code |
any update? Bump. |
Any updates on this?
...aand you cannot do it. And it's 2022. |
Any update on this? Or is it going to end up the same as any other feature request that anyone has ever asked for... closed by the bot, while you continue to work on Ivy, or something else that nobody needs? |
This "feature" should be implemented as soon as possible. There are some use cases that have this issue and the larger the application scales, the more issues arise. The mat-menu becomes partially unusable or requires a lot of redundant code, which is not acceptable for enterprise applications. Please work on this issue! |
Yep. We wanted the same thing and then found this issue which is open since May 28 2020... |
any updates? |
+1 |
I have to be that guy 😂 first to bump this in 2023! |
... and next bump :P |
And here it goes another one |
They are too busy with Signals or other useless cr@p, guys |
I also ran into one of the use cases listed above. That is with the Angular material components. The only workaround ends up being the replication of extensive amounts of boiler plate code in HTML. |
I just want to point out that maybe some of you could try angular/components#9411 (comment). I'm grateful to @GrandSchtroumpf for its workaround. |
Another stackblitz for a simple use-case, where the content of a child component is queried via a directive but the content is provided through a parent: https://stackblitz.com/edit/stackblitz-starters-fndspl?file=src%2Fmain.ts |
bump again |
There are multiple use-cases where one would like to reason about content provided to a component (check if content was provided at all, count the number of items etc.).
To make the discussion more concrete let's consider the following markup (full runnable scenario):
Given this markup the
<my-container>
component might want to answer the following questions:On top of this the
<my-container>
implementation might want to do the following (all the provided examples boil down to the ability of projecting items individually):Achieving any of the use-cases listed above is very difficult in the current Angular and it steams from the fact that one can't reason (count, pick-up, check presence etc.) about individual items to project.
While content queries can be used, to some degree, to reason about content items individually, the content queries approach has its problems as well:
This fundamental mismatch between content projection and content queries leads to many surprising situations and use-cases that can't be implemented really. Again, here is a "typical" example: https://stackblitz.com/edit/angular-ivy-sumkgl?file=src%2Fapp%2Fapp.component.ts
In short: content projection and content queries are good mechanisms while used separately, but as soon as we try to use both mechanisms together we start to bump into serious problems.
The idea behind opening this issue is to capture use-cases that are difficult to implement and expose problems where both content queries and content projection are used together. This should open ways to designing a more powerful content projection where it is possible to reason about and project content with one API. To set expectations: there are no immediate implementation plans, we want to capture use-cases and experiment with different APIs first.
The text was updated successfully, but these errors were encountered: