【问题标题】:Expression interpolation Javascript [duplicate]表达式插值Javascript [重复]
【发布时间】:2019-11-27 12:05:49
【问题描述】:

我需要 Angular 8 方面的帮助。我的代码现在是这样的:

this.starClicked.emit(' The rating ' + this.rating + ' was clicked');

但是我试了这样放还是不行:

this.starClicked.emit(' The rating ${this.rating} was clicked');

我的结果是完全相同的字符串: The rating ${this.rating} was clicked。 我不知道我是如何让这个表达式插值起作用的!

【问题讨论】:

    标签: javascript angular ecmascript-6


    【解决方案1】:

    模板文字由反引号 ` 括起来。

    【讨论】:

      猜你喜欢
      • 2014-10-20
      • 2020-08-23
      • 2012-06-02
      • 2014-12-26
      • 2018-02-12
      • 2017-10-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多