简体   繁体   中英

how do I set a variable for image base URL

i want to add variable for image base url, Iam working on an angular application, in that site contain lots of images in each component, how do i set a variable for image base URL.

i tried to add base-URL variable in separate "ts" file, but did not work,

Based from the comments you do it like this:

You add the ImagebaseUrl variable in the environment like this:

在此处输入图像描述

Then depending on the depth of the component in the Angular application you import it like this:

在此处输入图像描述

And then you can use it inside the component however you like.

It is very helpful if you use an IDE which can help you with automatic imports.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM