TypeError: Result of expression 'previousMenu.get(i)' [undefined] is not an object.
-
im getting a little lost on why this is happening to me
if i do console.log("Text = "+ previousMenu.get(i).name)
works shows me the text but when i try to pass on that value to another qml like my other model like sosubMenuModel.iName = previousMenu.get(i).name
i get the error
TypeError: Result of expression 'previousMenu.get(i)' [undefined] is not an object.
show you the code
@
function backButtonClicked() {
for (var i = 0; i < previousMenu.count; ++i)
{
previousMenu.remove(i)
subMenuModel.iName = previousMenu.get(i).name// want an if i = null
// do something here like change the state of the back button to disabled
}
}
@every item thats clicked gets appended to a listmodel then what i want to do is remove the LAST one in the list ie i = 1 remove 1 get 0
if i is null dosomethinghow can i achieve this ?