Description
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.