Filling out Modal Forms with angular

My issue is with using ngFor to generate and display data within a modal form. When clicking on any element, only the data of the first element on the page appears in the modal form. How can I make it so that the data changes for each element clicked? Here is my code:

                    <form target="_blank" novalidate="true" action="https://spondonit.us12.list-manage.com/subscribe/post?u=1462626880ade1ac87bd9c93a&amp;id=92a4423d01" method="get" class="form-inline">
        
                    <div class="d-flex flex-row">
                        <div class="modal fade" id="exampleModal3" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel3" aria-hidden="true">
                            <div class="modal-dialog" role="document">
                               
                              <div class="modal-content">
                                
                                <div class="modal-header">
                                  <h5 class="modal-title" id="exampleModalLabel3">Unit Details</h5>
                                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                    <span aria-hidden="true">&times;</span>
                                  </button>
                                </div>
                                <div class="col-lg-12">
                                    <br>
                                    <p>Project : {{prop.project}} <br>
                                        Unit Name : {{prop.unit_name}} <br>
                                       Unit Usage :  {{prop.unit_usage}} <br>
                                       Country : {{prop.country}} <br>
                                       Unit for : {{prop.unit_for}} <br>
                                       Finishing : {{prop.finishing}} <br>
                                       Property type : {{prop.property_type}} <br>
                                       City : {{prop.city}} <br>
                                       District: {{prop.district}} <br>
                                       Min. Area: {{prop.min_area}} <br>
                                       Starting Price: {{prop.starting_price}}<br> <br>
                                       <img style="height: 150px; width: 250px;" src= {{prop.img}}>
                                         </p>
                                      
                                        <div class="alert-msg">
                                        </div>
                                    </form>
                                </div>
              
                              </div>
                            </div>
                          </div>
                        </div>
                            <div style="position: absolute; left: -5000px;">
                                <input name="b_36c4fd991d266f23781ded980_aefe40901a" tabindex="-1" value="" type="text">
                            </div>
                    </div>      
                    <div class="info"></div>
                    </form>
            </div>
                <div class="images">
                    <img style="height: 250px; width: 350px;" class="content-image img-fluid d-block mx-auto" src= {{prop.img}} alt="" data-toggle="modal" data-target="#exampleModal3">
                    <span style="margin-top: 0px; color:black;background-color: rgba(255,255,255,0.3);"><br>{{prop.property_type}} <br><br><br> {{prop.developer}} <br><br><br> {{prop.district}} <br></span>
                </div>
            </div>
        </div>
        

Answer №1

There is a missing opening tag in the code snippet below:

       <div class="alert-msg">
                                </div>
                            </form>   <----Remove this
                        </div>

In order to fix the issue, change the properties list to the name of your choice.

<div class="col-lg-12" *ngFor="let prop of properties">

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Navigating through a multidimensional array in Angular 2 / TypeScript, moving both upwards and downwards

[ {id: 1, name: "test 1", children: [ {id: 2, name: "test 1-sub", children: []} ] }] Imagine a scenario where you have a JSON array structured like the example above, with each element potenti ...

sticky header on pinned tables in a React data grid

I have combined 3 tables together, with the middle table containing a minimum of 15 columns. This setup allows users to horizontally scroll through the additional columns conveniently. However, I am facing a challenge in implementing a sticky header featu ...

Error: The attribute 'detect' is not a valid property of object 'GraphModel'

I am currently experimenting with using TensorFlow JS to develop a real-time object detection application in Angular 13. My goal is to utilize a video element that captures footage from the webcam, and I am attempting to invoke the model.detect(video) meth ...

How can I utilize an angular directive to deactivate a component when the escape key is pressed?

Here is my approach to closing a popup by pressing the escape key. @Directive({ selector: '[escapeHostDestroy]', }) export class DestroyPopUpOnEscapeDirective { constructor( private renderer: Renderer2, private el: ElementRef, ...

Validators in Angular forms are a powerful tool for enforcing

Is it possible to use Validators in the ts.file to display an error message when a field is invalid, rather than directly in the html? Thanks. html <form [formGroup]="form"> <mat-form-field> <mat-label>Nom</mat-label> ...

Exploring error handling in onApplicationBootstrap() within NestJS

I have a TowerService method marked with @Injectable that is running in the onApplicationBootstrap() lifecycle hook. @Injectable() export class TasksService implements OnApplicationBootstrap { private readonly logger = new Logger(TasksService.name) co ...

What is the best way to pass down SectionList prop types in TypeScript when using React?

I am working on creating a wrapper for SectionList in React Native that needs to accept all the standard props of SectionList along with some custom ones. How can I set up typescript to accommodate this? Here is what I have tried: import React from &apos ...

Unlocking the Power of CheerioJS for Selecting Table Elements

I am struggling to figure out how to use CheerioJS to parse HTML table values and convert them into a JSON object. Despite my efforts, I have only been able to come up with a convoluted solution that doesn't quite work. My goal is to extract informa ...

Display a FullCalendar showcasing events for the next 30 days

I am currently working with the FullCalendar library and I have a unique request. I need to create a rolling 30-day view using the month grid style, complete with day headers. Additionally, I need the flexibility to set the starting day in the grid. For ...

Issue with Firebase CLI preventing deployment of Cloud Functions

I'm currently working on an Angular project, and I'm facing a challenge in deploying a single Firebase function. Here's how my functions directory is structured: https://i.sstatic.net/7h1q2.png When I run the command firebase deploy --only ...

How can I incorporate TypeScript paths into Storybook with Webpack version 5?

Storybook includes a pre-configured Webpack setup. Up until Webpack v4, it was possible to utilize tsconfig-paths-webpack-plugin and define custom tsconfig (or any other plugin) like so: const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plug ...

Problem with TypeScript types in Redux Toolkit when using Next.js and next-redux-wrapper

Check out the StackBlitz Demo here In my attempt to implement redux toolkit setup for next js based on guidance found here, I encountered a slight difference in the tsconfig.json where the original question had compilerOptions.strict = false while mine is ...

"Implementing a retry feature for Angular http requests triggered by a button

Imagine having a situation where a component has a method that triggers an http request defined in a service. The observable is subscribed to within the component: Component: fetchData() { this.apiService.fetchDataFromServer().subscribe( respo ...

Monitoring URL changes in Angular2 using the HostListener

I have a common navbar component that is included in every page of my website. I would like it to detect when the URL changes using a HostListener. @HostListener('window:hashchange', ['$event']) onHashChange(event) { this.checkCu ...

When subscribing to an Observable of type number or string (union type), NaN values are returned for string inputs

Within a component, I have a public member that is defined as follows: public docId$: Observable<number | string>; This means that the document ID can either be an integer or a string. Upon initializing in ngOnInit, I have the following code snippe ...

What is the mechanism for invoking functions defined with the arrow syntax in Angular?

Referencing this code snippet from the tutorial at https://angular.io/tutorial/toh-pt4, specifically within the hero.component.ts file: getHeroes(): void { this.heroService.getHeroes() .subscribe(heroes => this.heroes = heroes); } After analyz ...

Issue: Unrecognized element type in next.js while starting development server

Every time I run npm run dev, I encounter the following error: Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from th ...

The issue arises when TypeScript declarations contain conflicting variables across multiple dependencies

My current project uses .NET Core and ReactJS. Recently, I updated some packages to incorporate a new component in a .tsx file. Specifically, the version of @material-ui/core was updated from "@material-ui/core": "^3.0.3" to "@material-ui/core": "^4.1.3" i ...

What is the best way to access individual items within an *ngFor loop in Angular?

Is it possible to retrieve the value of item.profile image and utilize it in the update function shown in the code below? <ion-content> <ion-grid style ="text-align: center"> <ion-row class="ion-align-items-center" > ...

Tips for testing Observable.fromEvent

Can you provide a method to test Observable.fromEvent using jasmine? @ViewChild('d') private inputDatePicker: NgbInputDatepicker; this.subscription = Observable.fromEvent(document, 'click').subscribe((event: KeyboardEvent) => { ...