Variables File:
export class VariableSettings {
public static string_value: string = 'vikas/${id}/data';
}
Other File.
import {VariableSettings} from './variables';
getData(id:string ){
console.log(`${VariableSettings.string_value}`, `${id}`);
// it prints vikas/${id}/data abcd11123
}`
Now I want the result like that "vikas/abcd11123/data". So how can I inject the id in that string.
Any suggestion regarding the same will be appreciated.
Thanks
string_value (id) {return `vikas/${id}/data`}. In your case, it needs another treatment like using regex to match ${id}