I am using Angular 5 with Ionic 3. My main problem is that I cannot get the second key object of the object's name "myObj". Below are 2 examples that I have tried so far.
Example 1
home.ts:
...
export class HomePage {
myObj: any ={};
ionViewDidLoad() {
this.myObj = {
something: {value: 'value', name: 'name'}
}
}
}
home.html:
...
<p>{{myObj.something.name}}</p>
In this case I cannot get name but I can get
<p>{{myObj.something}}</p>
Why is that?
Example 2
home.ts:
...
export class HomePage {
myObj: {something: {value: string, name: string}};
ionViewDidLoad() {
this.myObj = {
something: {value: 'value', name: 'name'}
}
}
}
home.html:
...
<p>{{myObj.something | json}}</p>
In this example I cannot even get my first level key something.
All above examples shows me in the screen:
cannot read property * of undefined
* depends on property name ex. something or name