In my Angular app, I\'ve setup \"project\" as a $resource
. In my controller, I ask the server for the data over a GET request immediately when the page loads. I c
It looks like the server response comes back as the first argument to the callback to save
, so as long as the server responds with the full object data, you should be able to use it to create a "new" Project object like this:
function ProjectCtrl($scope, $routeParams, Project) {
$scope.project = Project.get({id: $routeParams.projectId},
function(data) { /* Successfully received data */ },
function(data) { /* Failed to receive data */ },
);
$scope.saveProject = function() {
$scope.project.save(function(data) {
$scope.project = new Project(data);
});
};
}