Maxime Matter
Maxime Matter

Reputation: 199

Angular 2 expression single quote escape

I'm using Angular 2 and I would like to write something like this

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

However I get an error because of the single quote between d and A. Is is possible to somehow escape this character?

Upvotes: 11

Views: 13098

Answers (1)

Günter Zöchbauer
Günter Zöchbauer

Reputation: 657761

Usually a \\

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

or

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

depending on where you put it.

Upvotes: 15

Related Questions