Click on the HTML page to load an Array of Arrays containing strings

Earlier, I posted a topic about an issue with Observable loading on an HTML page: Observable need a click to load on html page. Unfortunately, I am still facing the same display problem where I have to click on the input field to display the content of an Array<Array<string>>.

<section>
    <div class="divPosition">
      <mat-icon>place</mat-icon>
      <mat-form-field color="accent" appearance="fill" id="searchAddress">
        <mat-label>*****</mat-label>
        <input 
          matInput 
          ngx-google-places-autocomplete #placesRef="ngx-places" 
          (onAddressChange)="handleAddressChange($event)" [ngModel]="this.address" />
        <button mat-button *ngIf="address" matSuffix mat-icon-button aria-label="Clear" (click)="address=''">
          <mat-icon>close</mat-icon>
        </button>
      </mat-form-field>
    </div>
    <br />
    <div>
      <section class="mobile" fxLayout="column" fxLayoutAlign="center center" fxLayoutGap="20px" *ngFor="let docs of matchingDocs">
        <app-feeder-card
          [feederId] = "docs[0]"
          [clientId] = "docs[1]"
        ></app-feeder-card>
      </section>
      <section *ngIf="matchingDocs.length == 0" fxLayoutAlign="center center" fxLayout="column">
        <app-no-feeder
          [lat] = this.lat
          [lng] = this.long
          [address] = this.address
        ></app-no-feeder>
      </section>
    </div>
</section>
... (The rest of the code and discussions about the issue)

Answer №1

Once you have assigned matchingDocs to this.matchingDocs, insert the following code right after:

this.changeDetection.detectChanges(); 

Give it a try!

...
}).then((matchingDocs) => {
  // Process the matching documents
  this.matchingDocs = matchingDocs;
  this.changeDetection.detectChanges(); 
});

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

How to dynamically modify ion-list elements with Ionic on button click

Imagine having 3 different lists: List 1: bus, plane List 2: [related to bus] slow, can't fly List 3: [related to plane] fast, can fly In my Ionic Angular project, I have successfully implemented the first ion-list. How can I dynamically change th ...

How can I display a modal with image options and image selection using Ionic 4?

Currently, I am developing an Ionic 4 Angular application and implementing an Ionic modal feature. I would like to include images in the modal, so that when a user clicks on them, they are displayed. ...

Vee-Validate: Are flags on the field value yielding undefined results? Explained with TypeScript

The documentation states that by using a flag on the value of a field, I should be able to obtain a boolean. For example: computed: { isFormDirty() { return Object.keys(this.fields).some(key => this.fields[key].dirty); } }, I am working ...

Issue with the scoring algorithm using Angular and Spring Boot

Hello, I have created a scoring algorithm to calculate scores, but I encountered an error in "salaireNet". ERROR TypeError: Cannot read properties of null (reading 'salaireNet') at ScoringComponent.calculateScore (scoring.component.ts:33:55) ...

Passing generics to ComponentProps in TypeScript React: What is the best approach?

Scenario I have a Tree component with props defined using a generic type T: type ITreeProps<T> = ICollapsibleTreeProps<T> | INonCollapsibleTreeProps<T>; The component is implemented as follows: const Tree = <T extends {}>(props: ...

Angular 2 NG Dynamic Grid Columns

Can a grid be created where column widths are not fixed in pixels? This would particularly come in handy when paired with sizeColumnsToFit(). Take, for instance, the scenario in which the ID and Name columns should adjust to content size while the Descrip ...

Divide the firestore request into multiple filters

I am currently developing a filter system that allows users to search for specific parameters without filling out the entire form. For instance, they could search for games of a certain type but across all genres (leaving the form empty results in an empty ...

Getting started with testing in Angular 2

When I first started coding my app, unit tests were not on my mind. Now, I realize the importance and need to write them. However, while attempting to write tests using Jasmine only, I encountered an error when trying to import components - "system is no ...

Issue with Angular ngFor binding. What could be causing this error to occur?

I have a main component called DOCUMENT. This document receives a URL segment and retrieves an array of associated objects from my database. Then, using @Output() documents = new EventEmitter() and an @Input() in a DOCUMENT VIEW component, I loop through t ...

What is the best way to create a dynamic icon using React and TypeScript?

Excuse me, I am new to using React and TypeScript. I'm having trouble getting the icon to change based on the status in AppointmentType. The body color is working fine, but the icons are not changing. Can someone please help me solve this issue? const ...

What is the process for including a selected-by option in a VIS network graph?

I'm trying to outline the neighboring nodes of the node that has been selected (highlightNearest). https://i.sstatic.net/lynhu.png Unfortunately, I haven't had success achieving this using JavaScript. Link to StackBlitz ...

Steps to transfer data from a form input to a separate component using a service in Angular

In my setup, I am working with two components and hoping to gather input from one form and transmit this data to the other component. The first component looks like this: this.dal = this.form_search.get('dal').value; this.service.sendDataToSeco ...

Issue importing legacy JavaScript class_1.class as a constructor in TypeScript with Webpack

I am currently in the process of transitioning a project from JavaScript to TypeScript. The original JavaScript code is legacy and was not structured for exporting/importing, but rather concatenated together. I am facing challenges when trying to import th ...

Creating a OneToMany relationship in NestJS entity model

In my current project with NestJS, I am working on defining entity fields. While I have successfully defined a ManyToOne relation, I am facing difficulties in setting up the syntax for a OneToMany relation to match the structure of my other relationships. ...

Unable to determine all parameters for the ViewController: (?, ?, ?)

During my work on a project using IONIC 3 and Angular 4, I encountered the need to create a component responsible for managing popover controllers. Transferring data from this component to the popover component was straightforward. However, I ran into an i ...

In Angular 6, triggering a reset on a reactive form will activate all necessary validators

As a beginner in angular 6, I am currently facing an issue with resetting a form after submitting data. Although everything seems to be functioning properly, when I reset the form after successfully submitting data to the database, it triggers all the req ...

Implementing Basic Authentication for HTTP Requests in Angular 7

Currently, I am working with angular 7 along with Spring Boot and Spring Security. Within the Back End, I have successfully implemented basic authentication. However, while attempting to send a request from Angular with an Http Header that includes User n ...

Alert: The Runtime Error Zone has been already loaded in Ionic 3

My current project involves using Ionic 3 and Firebase Authentication with Firebase version 4.13.1. I have integrated Angularfire2 into my project and created a registration form that successfully stores user details in the Firebase database. However, afte ...

Tips for avoiding simultaneous state transitions in Angular UI Router

My situation in my Angular application involves a frustrating issue. Whenever a user double-clicks quickly on a link to a specific state (ui-sref link), the target state starts loading twice. This would be manageable if the state window didn't freeze ...

Integrating Angular 2 code into an existing JSF web application

I have a web application developed using JSF and Maven. Currently, the UI is built using JSF and I would like to add new screens using Angular 2 code within the same application while making REST calls. I am unsure about where to integrate the Angular co ...