1

From the Angular documentation:

<video #movieplayer ...>
<button (click)="movieplayer.play()">
</video>    

Creates a local variable movieplayer that provides access to the video element instance in data-binding and event-binding expressions in the current template.

Which I can understand, but I sometimes see the following notation in Angular Material components:

<button mat-button [matMenuTriggerFor]="menu">Menu</button>
<mat-menu #menu="matMenu"> <!-- What does "matMenu" mean here? --> 
  <button mat-menu-item>Item 1</button>
  <button mat-menu-item>Item 2</button>
</mat-menu>

I don't understand what the "matMenu" is used for? The example from Angular Material works well without it.

John
  • 10,165
  • 5
  • 55
  • 71
  • 1
    Read from `Fortunately, Template reference variable can have value (5)` in the answer https://stackoverflow.com/questions/45250259/what-is-auto-attribute-here-and-why-it-is-required#answer-45251464 – yurzui Dec 03 '19 at 09:34

0 Answers0