I have a problem where the ng-repeat aren't updating the list when the array change.
I'm using a JavaScript promise to compute a calculation to then return an object containing 2 arrays. These arrays is then to be shown on the view on the below code snippet.
<button class="btn" data-toggle="modal" data-target="#tableModal" ng-click="vm.compareTables(vm.table)">Some text</button>
<!-- Modal -->
<div class="modal fade" id="tableModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">{{ vm.table.title}}</h4>
</div>
<div class="modal-body">
<h4>You got</h4>
<p ng-repeat="g in vm.got">{{ g }}</p>
<h4>You dont:</h4>
<p ng-repeat="d in vm.dont">{{ d }}</p>
</div>
</div>
</div>
</div>
In the controller am I wrapping a function in a promise and it returns the right answer with 2 filled arrays. I can also print the result in the controller, the ng-repeat are just not updating the view.
var vm = this;
vm.compareTables = function (table) {
getData().then(function succesCallback(response) {
vm.ing = response.data;
var r = table;
var promise = pro(r, vm.ing);
promise.then(function (data) {
console.log(data.got);
console.log(data);
vm.got = data.got;
vm.dont = data.dont;
});
});
}
The above promise returns the right result.
I'm using angular 1.6.1 if that helps. The controller and view is connected to a component, which is working fine.
UPDATE