Why are events written as $event in Angular?

409 Views Asked by At

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

0

There are 0 best solutions below