Angular 2表达式单引号转义 [英] Angular 2 expression single quote escape
本文介绍了Angular 2表达式单引号转义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Angular 2,我想写这样的东西
I'm using Angular 2 and I would like to write something like this
*ngIf="game.Championship == 'Coupe d'Alsace'"
但是由于d和A之间的单引号而导致错误.是否有可能以某种方式转义此字符?
However I get an error because of the single quote between d and A. Is is possible to somehow escape this character?
推荐答案
通常是\\
*ngIf="game.Championship == 'Coupe d\'Alsace'"
或
*ngIf="game.Championship == 'Coupe d\\'Alsace'"
取决于放置位置.
这篇关于Angular 2表达式单引号转义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文