Setting the directive's inputs
In the previous code example, we declare a directive with the saTooltip selector. Note that Angular's HTML compiler is case sensitive, which means that it will distinguish [satooltip] and [saTooltip] as different selectors. After that, we declare the input of the directive using the @Input decorator over the saTooltip property. The semantics behind this code is that we declare a property called saTooltip and bind it to the value of the result that we got from the evaluation of the expression passed to the saTooltip attribute.
The @Input decorator accepts a single argument, that is, the name of the attribute we want to bind to. In case we don't pass an argument, Angular will create a binding between the attribute ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access