spartan icon indicating copy to clipboard operation
spartan copied to clipboard

NG0311: Directive CdkMenuTrigger does not have an input with a public name of brnMenuTriggerFor.

Open aaron47 opened this issue 1 year ago • 2 comments

Please provide the environment you discovered this bug in.

I have configured everything correctly in the vite config, but when I run the project with AnalogJS with ssr enabled, i run into this issue.

Which area/package is the issue in?

menubar

Description

The issue arises from the BrnMenuTriggerDirective, while I was trying to use it for a menubar.

Please provide the exception or error you saw

An error occured while server rendering /index.html:

	NG0311: Directive CdkMenuTrigger does not have an input with a public name of brnMenuTriggerFor.

Error: NG0311: Directive CdkMenuTrigger does not have an input with a public name of brnMenuTriggerFor.
    at validateMappings (C:\Users\Aaron\Projects\packages\core\src\error_details_base_url.ts:19129:23)
    at validateHostDirective (C:\Users\Aaron\Projects\packages\core\src\error_details_base_url.ts:19114:5)
    at Object.findHostDirectiveDefs (C:\Users\Aaron\Projects\packages\core\src\error_details_base_url.ts:19035:17)
    at findDirectiveDefMatches (C:\Users\Aaron\Projects\packages\core\src\error_details_base_url.ts:12362:48)
    at resolveDirectives (C:\Users\Aaron\Projects\packages\core\src\error_details_base_url.ts:12127:29)
    at elementStartFirstCreatePass (C:\Users\Aaron\Projects\packages\core\src\error_details_base_url.ts:24247:5)
    at ɵɵelementStart (C:\Users\Aaron\Projects\packages\core\src\error_details_base_url.ts:24283:11)
    at ProfileMenuComponent_Template (C:\Users\Aaron\Projects\eternumlol\boostdemo-analog\src\app\ui-components\profile-menu.component.ts:63:43)
    at executeTemplate (C:\Users\Aaron\Projects\packages\core\src\error_details_base_url.ts:11620:9)
    at renderView (C:\Users\Aaron\Projects\packages\core\src\error_details_base_url.ts:12827:13

Other information

No response

I would be willing to submit a PR to fix this issue

  • [ ] Yes
  • [X] No

aaron47 avatar Jul 14 '24 15:07 aaron47

Fixed by using the actual CdkMenuTrigger, and then doing [cdkMenuTriggerFor]="menu" instead of [brnMenuTriggerFor], what's the issue here?

aaron47 avatar Jul 14 '24 16:07 aaron47

I've had this issue too, this is the cause angular/angular#54096.

I'm also temporarily using the actual cdkMenuTrigger, there's only one error that occurs when clicking the trigger TypeError: Cannot read properties of undefined (reading 'originY'), but other than that it works fine.

DevWedeloper avatar Jul 15 '24 13:07 DevWedeloper

@DevWedeloper seems like the upstream issue got merged and this should be fixed with 18.2?

goetzrobin avatar Aug 22 '24 12:08 goetzrobin

@goetzrobin Yup, it's already fixed with that version.

DevWedeloper avatar Aug 23 '24 00:08 DevWedeloper

@aaron47 spartan is now running on 18.2.5 so once you upgrade your project to that version it should also resolve this issue!

goetzrobin avatar Sep 25 '24 11:09 goetzrobin