How to convert number to string inside angular 2 component:

Integer to string is as simple as calling .toString();

As @GünterZöchbauer said TypeScript has the same type coercion as JS, so numbers are automatically converted to strings when used in a string context

So no problem will occur same as Javascript, you can use number as string.

If you want you can do it like this so :

let num = 3;//number
let stringForm = num.toString();
console.log(stringForm);

Pls try

text:  `${this.errorMsg} Energy produced in the Energy`,

NB: Use `` (back-ticks) , instead of '' (apostrophe), to get your value.


you can use ''+your number

let num:number=3;
let numTxt:string=''+number;