在组件内部我有
export class AppComponent implements OnInit {
public errorMsg :number =10 ;
public doughnutChartOptions: any = {
cutoutPercentage: 85,
elements: {
center: {
text: this.errorMsg + ' Energy produced in the Energy',
fontColor: '#fff',
fontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
fontSize: 24,
fontStyle: 'normal'
}
}
};
text: this.errorMsg + ' some thing',
这是一个可接受属性的字符串,所以在这里我必须将数字转换为字符串。如何在Angular4、TypeScript 2.5中实现呢?