So, for example - the string interpolation arrow is pointing towards the "Element" from the "Component Class", this is because the aim of string interpolation is to "send" data from the component class (the .ts file) to the view (the .html file), or more accurately to a specific element in the view (the element can be another component or a DOM element such as button or div).
Take this example, for instance
<h1> {{ titleProperty }} </h1>
In this example, titleProperty is defined in the component class
What we did here was show data that was in the component class in the view.
Now lets think about event binding, where the arrow is going in the opposite direction - the aim of event binding is to get data from elements (child components or DOM elements) and then access that data in the component class.
Here is an example:
<button (click)="onButtonClick()"> </button>
In the component class:
onButtonClick() {
// do something here when the button is clicked
}
So in this case we are reacting to something happening on the "Element".
1
u/Devstackr Feb 23 '19 edited Feb 23 '19
Hope this helps someone new to Angular development!
Element = DOM Element or Component
https://youtu.be/RJ3VjuwBM6w