Skip to content
This repository was archived by the owner on Oct 1, 2023. It is now read-only.
This repository was archived by the owner on Oct 1, 2023. It is now read-only.

Edit controller on $scope.project returning $promise in the object #4

@mstojanovv

Description

@mstojanovv

app.controller('EditCtrl',['$scope','$routeParams','$location','Project',function($scope,$routeParams,$location,Project){
var self = this;
Project.get({id: $routeParams.id}, function(project) {
console.log(project)
self.original = project;
$scope.project = new Project(self.original);

});

$scope.isClean = function() {
return angular.equals(self.original, $scope.project);
};

$scope.destroy = function() {
self.original.destroy(function() {
$location.path('/');
});
};

$scope.save = function() {
$scope.project.update(function() {
$location.path('/');
});
};
}]);

When i console.log(project) here is the output in the console :
{id: "6", name: "asd", site: "http://google.com", description: "asd", $promise: d…}$promise: d$$state: Object__proto__: Object$resolved: truedescription: "asd"id: "6"name: "asd"site: "http://google.com"

So when trying to update the database error occured, trying to update $promise column

How can i fix this problem ?
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions