Aren Hovsepyan Aren Hovsepyan - 2 months ago 15
AngularJS Question

Angular 2 template's element reference not working properly

I am trying to manipulate html p tags text directly from template using angulars reference elements, but getting error

enter image description here

this is my code

<span *ngFor="let queuedTask of tasks">
(mouseover)="tooltip.innerText ="
(mouseout)="tooltip.innerText = 'text'">
<p *ngIf="queuedPomodoros > 0" #tooltip>{{tooltip.innerText || 'Mouseover for details' }}</p>

I am using this code from book and don't find any problem in realization myself.


Declare a variable in your component

Reference this variable in the p tag:

 <p *ngIf="queuedPomodoros > 0">{{ variable }}</p>

Change the value of the variable:

    (mouseover)="variable ="
    (mouseout)="variable = 'text'">