Skip to content
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

feat(cdk-menu): enable library devs to provide default items #27535

Open
spike-rabbit opened this issue Jul 28, 2023 · 0 comments
Open

feat(cdk-menu): enable library devs to provide default items #27535

spike-rabbit opened this issue Jul 28, 2023 · 0 comments
Labels
area: material/menu feature This issue represents a new feature or feature request rather than a bug or bug fix P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@spike-rabbit
Copy link
Contributor

Feature Description

As a library developer I want to build a menu around the cdkMenu which has some default items.

It is not possible to achieve it like this:

my-lib.component.html

<div cdkMenu>
  <ng-content></ng-content><!--  dynamic items from library consumer -->
  <div cdkMenuItem>default</div>
</div>

There is a runtime error saying the menu-stack cannot be injected. I guess the reason for this is: angular/angular#8563

Another approach would is to attach the ckdMenu as host directive to my-lib component. Then the ContentChildren are resolved, but the default item is not, because it is a view child.

I don't care how, but it would be cool if it is somehow is possible to have default items.

Use Case

I am part of a team that maintains an opinionated component lib for internal usage. We would like to replace most parts of our own menu implementation with the cdkMenu. We have some default items that every consuming application must have.

@spike-rabbit spike-rabbit added feature This issue represents a new feature or feature request rather than a bug or bug fix needs triage This issue needs to be triaged by the team labels Jul 28, 2023
@andrewseguin andrewseguin added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent area: material/menu and removed needs triage This issue needs to be triaged by the team labels Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: material/menu feature This issue represents a new feature or feature request rather than a bug or bug fix P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

No branches or pull requests

2 participants