While working on a tutorial using Ionic 2, I've encountered an issue where I cannot access an object property in the view. Here's an example:
// TypeScript file
export class MyClass {
myObject: any;
constructor() { }
ionViewDidLoad() {
this.myObject = getData(...);
}
}
// HTML
<p>{{ myObject.property }}<p>
The result shows: "Cannot read property 'property' of undefined at CompiledTemplate.proxyViewClass..."
Interestingly, I am able to log my object and see that it contains the desired property. Even when I try this:
<p>{{ myObject | json }}</p>
The JSON object is displayed with its property intact... It seems like accessing the property within the interpolation brackets is causing the issue.