I got a runtime error as cannot read property listArr of undefined
. I need to reuse that same array in multiple components. That's why I'm using Global array
I have added relevant code.please check it.
Global.ts :
export class Global {
public static listArr: ObservableArray<ListItem> = new ObservableArray<ListItem>();
}
ts file:
Global.listArr.push(data.items.map(item => new ListItem(item.id, item.name, item.marks)));
html file:
<ListView [items]="Global.listArr" > </ListView>