I have a scope varible containing an array of articles (JSON objects)
$scope.mainArticles = [];
An article has these properties
{
"title": "ABCD",
"type": "XYZ"
}
I Filter the scope variable $scope.mainArticles
based on article type, using the filter method of JS.
$scope.mainArticles = $scope.mainArticles.filter(filterByTypeFunction);
But my DOM never updates even though the scope variable has changed. Is there any way I can avoid using $scope.$digest()
or $scope.$apply()
in this scenario?
I don't wanna use them since there are plenty of answers here which advises against using them.