That's was surprise, but simple function array.IndexOf is not working.
$scope.nextProduct = function (pos, item) {
switch (pos) {
case 0: product = $scope.Menu[0].Breakfast
break
case 1: product = $scope.Menu[0].Lunch
break
case 2: product = $scope.Menu[0].BeforTraining
break
case 3: product = $scope.Menu[0].AfterTraining
break
case 4: product = $scope.Menu[0].Dinner
break
default: product = $scope.Menu[0].Breakfast
break
}
var index = product.indexOf(item.Name);
product[index - 1].IsSelect = false;
product[index + 1].IsSelected = true;
}
indexOf return -1 but I'm completely sure that the item exist in array. What can be wrong here?