angular 4 cannot read property 'id' of undefined
In your *ngFor
you can change it to *ngFor="let r of results | async"
Your problem is that the data isn't there yet, so it can't read the id property.
If you use the async pipe, it should wait for the data to come before displaying it.
Make use of Elvis Operator instead i:e safe operator
{{results?.ip}}
You get this error also if you add your component to the import array instead of the declaration array.
@NgModule({
imports: [
...,
someComponent
],
declarations: [...],
})
export class MainModule { }
Should be
@NgModule({
imports: [
...,
],
declarations: [...,someComponent],
})
export class MainModule { }