Read JSON file in AngularJS 2 Error: Cannot read property getDOM of undefined

Last Reply 11 months ago By dharmendr

Posted 11 months ago

Hi all

I am doing the example for read json from the file in angular2

here is My code.

export class JsonComponent {
  people: Object[];
  constructor(http: Http) {
    http.get('people.json').subscribe(res => {
      this.people = res.json();
    });
  }
  active: boolean = false;
  toggleActiveState() {
    this.active = !this.active;
  }
}

I am geting error in console As Cannot read property 'getDOM' of undefined

please help me

thanks and regards

siddu

You are viewing reply posted by: dharmendr 11 months ago.