如何将值分配给 angular 中的变量 7

How to assign the values to variable in angular 7

我正在尝试将值分配给变量而不是working.If任何知道的人请帮助找到解决方案。

我的代码:

app.component.ts:

public power:any;
public ice:any;
public cake:any;

changeValue(prop,val){

this.[prop]=val;
console.log(this.[prop]);

}

this.changeValue("power","124525");
this.changeValue("ice","125658");
this.changeValue("cake","122568");
public power:any;
public ice:any;
public cake:any;

changeValue(prop,val){

this[prop]=val;
console.log(this[prop]);

}

this.changeValue("power","124525");
this.changeValue("ice","125658");
this.changeValue("cake","122568");