In my angular project, I have the following:
TS
this.storage.get(item_section).then((value) => {
this.item= value;
console.log(this.item); //The console log gives `["name","item","size"]`
console.log(this.item[1]); //Gives `item` as the console log
});
HTML
<div class="something">{{item}}</div> //Displays "name,item,size"
<div class="something">{{item[1]}}</div> //Gets Undefined error
If I can define the this.item
and get results for {{item}}
, how come I get undefined error for {{item[1]}}
?
I am little confused to how to fix this