manishit56 / Angular4-JsonEditor

Wrapper for jsonedior in angular 4+ application
MIT License
39 stars 17 forks source link

Example loading remote data? #3

Closed jasonhjohnson closed 6 years ago

jasonhjohnson commented 6 years ago

I'm trying to load json from a remote source and it's not loading in the content.

My code:

ngOnInit() {
    this.lookupService.getLookups().subscribe(
      (lookups) => {
        console.log(lookups); // this returns valid json
        this.data = JSON.parse(JSON.stringify(lookups));
      },
      (error) => console.log('Error retrieving lookups: ' + error));
  }

Any help is appreciated.

jasonhjohnson commented 6 years ago

Just had to wait to initialize the control until after data was available