I have an AngularJS app that has script:
var itms = $scope.tree.getItems();
var lst = [];
for (i = 0; i < itms.length; i++) {
var item = {
level: itms[i].level,
value: itms[i].value
};
lst.push(item);
}
In my Angular 2 project I have the same thing.
let itms = this.tree.getItems();
let lst: any = [];
for (let i = 0; i < itms.length; i++) {
let item = {
level: itms[i].level,
value: itms[i].value
};
lst.push(item);
};
In VS2017, this does not work because the compiler does not recognize the level property. It does work if you add level to the treeitem interface. You can also see the level property if you send itms[i] to the console.
What is the proper way to get the item’s tree level?