My situation is as follows:
/items/item/123/edit
and I have a controller that combines both the view and edit functionalities:
...
if ($routeParams.id) {
$scope.itemId = $routeParams.id;
$scope.editMode = true;
Item.getBoxes({id: $routeParams.id}).$promise.then(function (data) {
$scope.data.boxId = [];
angular.forEach(data, function (obj) {
$scope.data.boxId.push(obj.id);
$scope.boxCache[obj.id] = {id: obj.id, name: {id: obj.id, name: obj.name}};
});
$scope.items= data;
});
}
...
In most cases (7 out of 8), everything works fine but sometimes the data doesn't bind correctly to the view.
I am unable to use $scope.$apply()
or $scope.$digest()
due to them being in progress.