Interviews2 answers
When to use prefix $ and when $$ in Angular?
2 Answers
The $ prefix is there to namespace Angular-provided services. To prevent collisions it's best to avoid naming your services and models anything that begins with a $.
$$ prefix variable are treated as private variable, the reason behind adding $$ before the variable name is, that will avoid the internal variable conflicts and they wouldn't be exposed for external use.
Like in angular you could find many of them, $$observers, $$watchers, $$childHead, $$childTail, $$ChildScope, etc
Pooja SinghPosted Apr 17, 2019, 2:44 AM EDT
$ used prefix naming Convention while creating services
$$ used prefix variable name as private variable
Amit PrabhuPosted Dec 25, 2018, 3:08 AM EST

