Hello to all, welcome to therichpost.com. In this post, I will tell you, Set & Get Base URL for Images in Angular 15.
Guy’s Angular 15 came and if you are new in Angular 15 then please check below links:
Here is the working code snippet and please follow carefully:
1. Now you need to add below code into your src/environments/environments.ts file:
export const environment = { ... imageURL:"assets/images" };
2. Now you need to add below code into your src/app/app.component.ts file:
... import { environment } from 'src/environments/environment'; export class AppComponent { ... imageURL = environment.imageURL; }
3. Now you need to add below code into src/app/app.component.html file:
<img [src]="imageURL+'/imagename'"/>
In the end, don’t forgot to run ng serve command. If you have any query then do comment below.
Note: Friends, I just tell the basic setup and things, you can change the code according to your requirements. For better understanding please watch the above video.
I will appreciate that if you will tell your views for this post. Nothing matters if your views will be good or bad.
Jassa
Thank you.
Recent Comments