Skip to content

[mat-menu] Passing in data to a menu - mistake in documentation/example #9944

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

Closed
martinpreky opened this issue Feb 14, 2018 · 1 comment · Fixed by #9954
Closed

[mat-menu] Passing in data to a menu - mistake in documentation/example #9944

martinpreky opened this issue Feb 14, 2018 · 1 comment · Fixed by #9954
Assignees
Labels
docs This issue is related to documentation P4 A relatively minor issue that is not relevant to core functions

Comments

@martinpreky
Copy link

martinpreky commented Feb 14, 2018

Bug, feature request, or proposal:

Bug - mistake in documentation for material.angular.io

What is the expected behavior?

Working according to documentation/example.

What is the current behavior?

This example:
https://material.angular.io/components/menu/overview#passing-in-data-to-a-menu

is not working, throws error
"Template parse errors: "let-" is only supported on ng-template elements."

What are the steps to reproduce?

https://stackblitz.com/edit/angular-rlfbhk

What is the use-case or motivation for changing an existing behavior?

... i think motivation is obvious. There is a malfunctioned example in documentation.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

all

Is there anything else we should know?

working example is here, at the very bottom in .spec
https://github.com/angular/material2/blob/master/src/lib/menu/menu.spec.ts

<button
     [matMenuTriggerFor]="menu"
     [matMenuTriggerData]="{label: 'one'}"
     #triggerOne="matMenuTrigger">One</button>
<button
     [matMenuTriggerFor]="menu"
     [matMenuTriggerData]="{label: 'two'}"
     #triggerTwo="matMenuTrigger">Two</button>
<mat-menu matMenuContent #menu="matMenu">
     <ng-template let-label="label" matMenuContent>
       <button mat-menu-item>{{label}}</button>
     </ng-template>
</mat-menu>

Current documentation is here:
https://github.com/angular/material2/blob/master/src/lib/menu/menu.md

@crisbeto crisbeto self-assigned this Feb 14, 2018
@crisbeto crisbeto added docs This issue is related to documentation has pr P4 A relatively minor issue that is not relevant to core functions labels Feb 14, 2018
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 14, 2018
Fixes an incorrect example in the menu docs and the `matMenuContent` being used incorrectly in a unit test.

Fixes angular#9944.
jelbourn pushed a commit that referenced this issue Feb 20, 2018
Fixes an incorrect example in the menu docs and the `matMenuContent` being used incorrectly in a unit test.

Fixes #9944.
tinayuangao pushed a commit that referenced this issue Feb 20, 2018
Fixes an incorrect example in the menu docs and the `matMenuContent` being used incorrectly in a unit test.

Fixes #9944.
andrewseguin pushed a commit that referenced this issue Feb 20, 2018
Fixes an incorrect example in the menu docs and the `matMenuContent` being used incorrectly in a unit test.

Fixes #9944.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
docs This issue is related to documentation P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants