Reputation: 2047
I am trying to manipulate html p tags text directly from template using angulars reference elements, but getting error
this is my code
<p>
<span *ngFor="let queuedTask of tasks">
<pomodoro-task-icons
[task]="queuedTask"
(mouseover)="tooltip.innerText = queuedTask.name"
(mouseout)="tooltip.innerText = 'text'">
</pomodoro-task-icons>
</span>
</p>
<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.
Upvotes: 0
Views: 444
Reputation: 8099
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
:
<pomodoro-task-icons
[task]="queuedTask"
(mouseover)="variable = queuedTask.name"
(mouseout)="variable = 'text'">
</pomodoro-task-icons>
Upvotes: 2