$scope.runTest = function() {
var statesArray = ['Running', 'Complete', 'Rejected'];
var rand = statesArray[Math.floor(Math.random() * statesArray.length)];
item.state = 'Running';
console.log(rand)
window.setTimeout(function() {
item.state = rand;
}, 6000);
};
item
state change to Running
is successful, but after that state won't change to a random as stated in the window.setTimeout
function.
Where am I wrong here?