What is the $$ (double dollar sign) used for in angular?
- Single
$
for reserved, public identifiers - Double
$$
for reserved private identifiers
To quote the docs:
$ Prefix Naming Convention
...
If you inspect a Scope, you may also notice some properties that begin with $$. These properties are considered private, and should not be accessed or modified.
angular2 style guide - property with dollar sign?
$ suffix (popularized by Cycle.js) is used to indicate that the variable is an Observable.
It could make it to the official style guide too but it's not there yet
Read more here : What does the suffixed dollar sign $
mean?
Update:
Read more about the trailing “$” sign on Angular website here:
https://angular.io/guide/rx-library#naming-conventions-for-observables
what is $$ before varible in typescript?
$ and also $$ are valid variable names in javascript with no special meaning whatsoever and thus also have no special meaning in typescript.
What does $ sign at the end of function name indicate?
Syntactically, the dollar ($
) character has no special meaning in JavaScript identifiers.
It is, however, sometimes used by convention to indicate that a variable holds an Observable
or that a function will return an Observable
.
Meaning of $$ in angular
$$
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.
AngularJS and its use of Dollar Variables
There are a few times Angular ignores variables prefixed with the dollar sign:
- In Schumli's comment below, where json filters will not output them
When using the
{{ }}
directive, angular will not show nested$
variables. For example this only displays thevisible
property.<div ng-init="n = { visible: 'foo', $ignore: 'bar' };">{{ n }}</div>
Additionally when adding an explicit watcher on a scope object, changes to properties with a leading dollar sign of this object will not trigger the watcher. See this updated fiddle.
angular.equals()
ignores keys prefixed with$
.
What does ${} (dollar sign and curly braces) mean in a string in JavaScript?
You're talking about template literals.
They allow for both multiline strings and string interpolation.
Multiline strings:
console.log(`foobar`);// foo// bar
Related Topics
How to Sort/Order Keys in JavaScript Objects
Get Path Params in React-Router V4
How to Update React Context from Inside a Child Component
JSON Stringify Changes Time of Date Because of Utc
What Does Document.Domain = Document.Domain Do
Why Isn't This Object Being Passed by Reference When Assigning Something Else to It
Case Insensitive Jquery Attribute Selector
Skip Arguments in a JavaScript Function
Jquery Get Values of Checked Checkboxes into Array
Code with Classlist Does Not Work in Ie
Passing Variables to the Next Middleware Using Next() in Express.Js
Capture Click on Div Surrounding an Iframe
React - How to Force a Function Component to Render
Event Listener for When Element Becomes Visible
Microsecond Timing in JavaScript
How to Use Blob Url, Mediasource or Other Methods to Play Concatenated Blobs of Media Fragments