Parth Trivedi Parth Trivedi - 4 months ago 36
AngularJS Question

Angular2 : Render Html trusted characters &times and &copy

I am facing issue when rendering &times in Component template.

@Component({
selector:'my-app',
template:`
<div>
<input [(ngModel)]="toDoModel" type="text">
<button (click)="onClickToDo(toDoModel)">Click me</button>
<ul>
<li *ngFor="let item of todoList; let i = index">{{item}}
<a (click)="remove(i)">&times</a>
</li>
</ul>
</div>`
})

Answer

It looks like you forgot to put the ; character at the end of the sequence.

The following will render successfully:

<a (click)="remove(i)">&times;</a>

Plunker for example usage