app.controller('editPetController',function ($scope,people) { $scope.confirm = function (new_petname) { people.modifyPet($scope.tperson,$scope.tpet,new_petname,function (err) { console.log(err) $scope.closeThisDialog() }) } $scope.delete = function () { people.removePet($scope.tperson,$scope.tpet,function (err) { $scope.closeThisDialog() }) } })