I'm pretty new to html/CSS/Angular, and I have a question about something I've been using for a while, but realized that I don't quite understand its significance: the hash symbol (#).
This symbol is used a lot in Angular --
<some-element id="my-element" #myElement></some-element>
These two variables, myElementById and myElementByHash, seem to be functionally identical:
let myElementById = document.getElementById("my-element");
@ViewChild("myElement") someElement;
let myElementByHash = this.someElement.nativeElement;
<some-menu>
a reference name #someMenu
, which will be used as the target of the [mdMenuTriggerFor]
binding.
The hash symbol is overloaded with different types of uses in the world of web development -- it functions as a URL fragment identifier, CSS id selector, as well as this "reference name" identifier in the Angular apps I have worked on. Because of its many uses, it have been very difficult for me to find a clear explanation online of what this symbol actually does.
So, SO, my questions to you are
What is the significance of the hash symbol (#), OR where can I find the documentation explaining this?
What are the similarities/differences in usage between the hash symbol and the id property of an element?
Thanks!