Reputation: 14520
I'd like to be able to do something like this:
<img src="{{photoUrl.replace('upload/', 'upload/' + environment.someVariable)}}">
I can access my environment variables inside my .TS file like below but it's not recognized in the HTML file.
import { environment } from 'src/environments/environment';
ngOnInit(): void {
const something = environment.someVariable;
}
Upvotes: 1
Views: 4331
Reputation: 1966
yes just create one property in component then assign the value of your environment.
ts:
public environment = environment;
html:
{{environment.someVariable}}
Upvotes: 3