angular load json file with httpclient

import { HttpClient } from '@angular/common/http'; 
import { Observable } from 'rxjs';

@Injectable()
export class AppSettingsService {

   constructor(private http: HttpClient) {
        this.getJSON().subscribe(data => {
            console.log(data);
        });
    }

    public getJSON(): Observable<any> {
        return this.http.get("./assets/mydata.json");
    }
}

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
HttpClient read file json angular 11 angular httpclient get json file http get json data angular get json data httpclient angularjs get json data httpclient angular angular httpclient load json file angular use httpclient.get to get a json file in prod angular use httpclient.get to get a json file on prod angualr use httpclient.get to get a json file angular how to use json file with http get on prod angular get data from local json file using httpclient angular httpclient get a local json file angular 10 get http from json file angular http put example json server angular load json data http angular httpclient read json file no work angular httpclient read json file call api from json file angular call api json file angular get json via http get angularjs angularjs http get local json file get json file without httpclient angular call json file using httpclient angular call json file angular httpclient angular read json file httpclient httpclient read json file angular use HttpClient to load local json file angular angular http client read json file angular read json http http get json angular angular http json file objects angular http json file angular http get json how to access json file using httpclient in angular 9 without putting it in assets folder how to access json file using httpclient in angular 9 how to access json file using httpclient in angular read data from json file in angular using http http.get json file in angular read json file using httpclient angular how to get json data from online json file using httpclient in angular Angular Read Local JSON Files Using HttpClientModule How to read JSON file in Angular 8 using http read local json file using Angular HttpClient get local json file in my angular project with httpclient angular http get from json file go through json file in angular 8 in Http go through json file in angular in Http
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source