Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

In angular when i click in anywhere data will be display so can u find the error

ngOnInit() {
    this.getPosts()
      .subscribe((config: any) => {
        this.data = Object.values(config);
        this.config=this.data[0];    })}
  getPosts() {
   
    return this.http.post<any>(this.postsUrl, raw
      , { 'headers': headers });}

In angular i used this method and used ngfor, and it will print data
after any click ! help me

  <nb-option *ngFor="let vehicle of config" [value]="vehicle.REGIS_NO">
{{ vehicle.REGIS_NO }}
</nb-option>

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

add detectors to detact any change after component load.

constructor(private cd : ChangeDetectorRef ) { }

Add this.cd.markForCheck() after subscribe

.subscribe((config: any) => {
    this.cd.markForCheck()
    this.data = Object.values(config);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading