Not sure why this is happening here, I am getting this error from my component:
ERROR TypeError: Cannot read property 'timezone_offset' of undefined
at Object.eval [as updateRenderer] (SettingsComponent.html:16)
at Object.debugUpdateRenderer [as updateRenderer] (core.js:14377)
at checkAndUpdateView (core.js:13513)
at callViewAction (core.js:13858)
at execComponentViewsAction (core.js:13790)
at checkAndUpdateView (core.js:13514)
at callViewAction (core.js:13858)
at execEmbeddedViewsAction (core.js:13816)
at checkAndUpdateView (core.js:13509)
at callViewAction (core.js:13858)
Interestingly enough it still displays the correct string in the template and there are no errors in ng-cli. Here is the code for the component producing the error:
import { Component, OnInit } from '@angular/core';
import { GetProfileService } from '../../services/get-profile.service';
@Component({
selector: 'app-settings',
templateUrl: './settings.component.html'
})
export class SettingsComponent implements OnInit {
results: any;
profile: any;
constructor(private getProfileService: GetProfileService) { }
ngOnInit() {
this.getProfileService.profileAPI().subscribe(
data => {
this.results = data
this.profile = this.results
console.log(this.profile)
}
);
}
}
I am for now just using {{ profile.timezone_offset }} as the only thing on my template...
{{ profile?.timezone_offset }}.{{ profile?.timezone_offset }}?