Home > Software design >  how do I set a variable for image base URL
how do I set a variable for image base URL

Time:01-20

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,

CodePudding user response:

Based from the comments you do it like this:

You add the ImagebaseUrl variable in the environment like this:

enter image description here

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

enter image description here

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.

  • Related