I have route like:
/items/item/123/edit
and controller (one controller for view and edit):
...
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;
});
}
...
7 from 8 cases worked correctly but sometimes doesn't bind data to view.
I can't coll $scope.$apply() or $scope.$digest() because their in progress