Hopefully this hasn't been asked.. I looked around and haven't found anything yet.
I have a single view that provides the user with a modal dialog (wizard) to create a few things and then save them. It seems as if everything is working except for that the view uses an ng-repeat to list the items created and it doesn't update when new items are pushed into the list. Consider the following example.
app.service('Utils', function() {
});
function controller1($scope,Utils) {
$scope.myList = [];
Utils.add = function(obj) {
$scope.myList.push(obj);
}
};
function controller2($scope,Utils) {
var temp = {"name":"John Doe"};
Utils.add(temp);
};
This is extremely basic but it provides enough insight into what I'm doing. $scope.myList is shown in the view using ng-repeat. At some time, I display the wizard, go through the process of creating a new item, then push that item to the list. The add function is part of the Utils service that serves other purposes, but isn't necessary to outline them here. The add function is declared in the first controller and accessible via the second. The operation of creating the new item and pushing it into $scope.myList works fine. I can look at the $scope of the first controller and see that the variable contains a single new object, but the view never updates to show it.
Any thoughts on what would be causing the view to not update? Is there a better way to do this? I found the recommendation for using a service as an intermediary somewhere else but if there is a better way that would resolve this issue as well, I'm up for it.