2

I'm an Angular beginner, and during the course of learning Angular, various tutorials and websites have used naming conventions that declare events as $event as shown in below snippet:

@HostListener('dragover', ['$event'])
  onDragOver($event) {
    $event.preventDefault();
    this.hovered.emit(true);
  }

I've also seen similar conventions for naming observables where observables are named as myObservable$

A similar question: What is the meaning of $ in a variable name? actually even mentions that it is against convention to start a variable name with the $ sign

My question is, does the dollar symbol bear any additional significance in Angular? Does it affect event binding in any way or are these just accepted conventions? Appreciate even if someone can just point me in the right direction with a significant link to documentation

Marc Al
  • 27
  • 1
  • 6
  • Check this answer will help You: https://stackoverflow.com/questions/37671700/angular2-style-guide-property-with-dollar-sign – Zrelli Majdi May 09 '22 at 12:26
  • 1
    Does this answer your question? [angular2 style guide - property with dollar sign?](https://stackoverflow.com/questions/37671700/angular2-style-guide-property-with-dollar-sign) – Zrelli Majdi May 09 '22 at 12:26
  • 1
    Yes these links were helpful, thanks so much So pretty much the same thing applied to events too right? That its just a naming convention, nothing more? – Marc Al May 09 '22 at 12:35
  • 1
    Does this answer your question? [What is the effect of adding '$' dollar sign infront of event in Angular?](https://stackoverflow.com/questions/59806643/what-is-the-effect-of-adding-dollar-sign-infront-of-event-in-angular) – Yong Shun May 09 '22 at 12:54

0 Answers0