You will need 2 things:

  1. HttpClient you will need to perform depedency injection where you would call the provideHttpClient helper function in the app.config.ts. From there, you can use the HttpClient method.

  2. OnInit interface (if you want to fetch data when a page is loaded)

example of an implementation:

export class AppComponent implements OnInit {
  public http = inject(HttpClient)
 
  ngOnInit() {
    this.http.get(`some url`).subscribe(config => {
      console.log('data', config)
    })
  }
}
 

Displaying the data

  • need to use @Input (for prop passing)