Hello to all, welcome again on therichpost.com. In this post, I will tell you, Angular 8 enlarge image in custom bootstrap modal.
This example is with my own thought and may be it will be helpful to someone.
Angular 8 enlarge image in custom bootstrap modal
Here is the complete working steps and please do it very carefully:
1. Here are the basics commands to install angular 8 on your system:
npm install -g @angular/cli
ng new angularpopup //Create new Angular Project
$ cd angularpopup // Go inside the Angular Project Folder
ng serve --open // Run and Open the Angular Project
http://localhost:4200/ // Working Angular Project Url
Â
2. After done with above, you need to run below commands to set bootstrap environment into your angular 8 application:
npm install --save bootstrap
Â
3. Now you need to add below code into your angular.json file:
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 19, MedusaJs, Next.js, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.
I have a problem, I try to use the modal on a ngfor
in “mydata” I have 2 images, but it always displays my image 2 in the modal when I click on image 1 and 2.
Hi, for this you can use jquery trick $(this) onclick function. First you can get the image src ans paste same image src inside model image src with you can get the same image inside modal.
5 comments
thanks for your solution.. really it was good
Thanks 🙂
Hi, it’s very good, thanks you
I have a problem, I try to use the modal on a ngfor
in “mydata” I have 2 images, but it always displays my image 2 in the modal when I click on image 1 and 2.
Have you got an idea please ?
{{mydata.id}}
Image {{mydata.id}}
Close
Hi, for this you can use jquery trick $(this) onclick function. First you can get the image src ans paste same image src inside model image src with you can get the same image inside modal.
Thanks
I tried to use the $(this) jquery trick. Can you explain more how to use it?