When updating the array inside a function, the view does not automatically update. However, if you use console.log to check the array after pushing values, it shows the updated array. Even trying $scope.apply() inside $timeout did not solve this issue.
JavaScript:
$scope.openQuestions = [];
$scope.openQuestions.push({value: '1', question: 'abc1'});
$timeout(function() {
$scope.$apply(function() {
$scope.fetchOpen();
});
}, 500);
console.log($scope.openQuestions); //shows the updated value
$scope.fetchOpen = function() {
$scope.openQuestions.push({value: '2', question: 'abc2'});
}
Html
<ul>
<li ng-repeat = "question in openQuestions">
<p>{{question.question}} </p>
</li>
</ul>
Result: abc1