[Angular] Why create local variables in templates?

joellau

Joel Lau

Posted on May 17, 2020

[Angular] Why create local variables in templates?

I'm a newbie trying to pick up some angular when I came across this strange bit of code.

<video #movieplayer ...>
    <button (click)="movieplayer.play()">
</video>
Enter fullscreen mode Exit fullscreen mode

When / why would I create a local variable (movieplayer) in the .html file rather than its .ts?

💖 đŸ’Ș 🙅 đŸš©
joellau
Joel Lau

Posted on May 17, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related