Hello everyone, how are you? Can you help me implement a feature in my Angular project? In image 1, I have a list of companies and when I click on the eye, it brings the columns CNPJ, corporate name, trade name and registration status to the card in image 2. I managed to pass this through an array, in the case of the image I passed an array [3] which is the fourth CNPJ on the list. My goal is to improve this, instead of manually setting the array I want it to capture the user's click and load the data from this capture to the card in image 2. For example, when the user clicks on the first CNPJ on the list, it has to bring the data to the card. Could someone give me an idea or suggestions on how to do this?
Here is an excerpt from the component, so you can understand better
getEmpresaVinculada() { this.simplesNacionalService.getEmpresasVinculadas().subscribe( (data: any[]) => { if (data && data.length > 0) { this.empresa = data[3]; } }, (error) => { console.error('Error fetching company data:', error); } ); } getConsultaIrregularidades(cnpj: string): void { this.simplesNacionalService.getConsultaIrregularidades(cnpj).subscribe( (data: any) => { this.consultaIrreg = data; }, (error) => { console.error('Error fetching irregularities', error); } ); }