feat(cdk-menu): enable library devs to provide default items #27535
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
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
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.The text was updated successfully, but these errors were encountered: