0

What is the reason for the $ used in Angular. Is it a specific RxJS

What is the reason for the $ used in the click$ & interval$ in the example code below:

const click$ = fromEvent(document, 'click').pipe(
  map((e: MouseEvent) => ({
    x: e.clientX,
    y: e.clientY,
    id: Math.random()
  })),
  tap(addHtmlElement),
  mergeMap(coords => subject.pipe(tap(v => setElementText(coords.id, v))))
);

const interval$ = interval(1000).pipe(
  tap(v => subject.next(v)),
  tap(v => setElementText('intervalValue', v))
);

merge(click$, interval$).subscribe();
Wanz
  • 137
  • 9
  • 3
    It's a naming pattern that many use to quickly identify observables. It's not Angular specific. See https://cycle.js.org/basic-examples.html#basic-examples-increment-a-counter-what-is-the-convention – Ruan Mendes Feb 04 '22 at 14:44

1 Answers1

0

The $ suffix is only a naming convention used for observables. It has no deeper meaning - analogous to naming interfaces with an I prefix (e.g. ICollection).

pascalpuetz
  • 5,238
  • 1
  • 13
  • 26
  • 1
    Please don't answer question that already have answers at StackOverflow. It's better to mark them as duplicates so we have a single source of truth. See https://stackoverflow.com/a/37928549/227299 – Ruan Mendes Feb 04 '22 at 14:46