Angular 2 single quote expression

I am using Angular 2 and I would like to write something like this

*ngIf="game.Championship == 'Coupe d'Alsace'" 

However, I get an error due to a single quote between d and A. Is it possible to somehow escape this character?

+5
source share
1 answer

Usually \\

 *ngIf="game.Championship == 'Coupe d\'Alsace'" 

or

 *ngIf="game.Championship == 'Coupe d\\'Alsace'" 

depending on where you placed it.

+5
source

Source: https://habr.com/ru/post/1257838/


All Articles