【问题标题】:Angular 2 | cannot assign to variable because it is a constant or a read-only property角 2 |无法分配给变量,因为它是常量或只读属性
【发布时间】:2018-06-29 07:56:44
【问题描述】:

当我在构造函数中使用变量名时,它会显示消息

[ts] 无法分配给“名称”,因为它是常量或只读的 财产!!

【问题讨论】:

    标签: angular


    【解决方案1】:

    终于有答案了!!我们应该使用 this.name。

    ngOnInit() {
        this.name='Amritha';
      }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-01-09
      • 2018-12-07
      • 2018-10-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-24
      相关资源
      最近更新 更多