는 HTML 뷰와 모델 각 컨트롤러 클래스와 기본 각 웹 응용 프로그램이
내 각 컨트롤러 스크립트 파일이 포함이되어
var taskResource = $resource("http://localhost:3000/api/tasks/:id", { id: '@id' });
$scope.tasks = taskResource.query();
noError = function() {
$scope.error = "";
}
onFailure = function() {
$scope.error = "Error communicating with server";
}
$scope.changeTaskDone = function (task) {
$scope.tasks.$save(task, noError, onFailure);
};
내 HTML은
을 포함<tr ng-class="{'task-done': task.done}" ng-repeat="task in tasks | orderBy: '-priority'">
<td class="small-cell">
<button type="button" class="btn btn-xs btn-danger" ng-click="deleteTask(task)">
<span class="glyphicon glyphicon-remove"></span>
</button>
</td>
<td class="small-cell">
<input type="checkbox" ng-model="task.done" ng-change="changeTaskDone(task)" />
</td>
noError 및 OnFailure 콜백이 호출되지 않습니다.
EDIT 로컬 호스트는 나에 의해 개발 된 노드 서버입니다. 성공적인 콜백이 클라이언트 측에서 활성화되기 위해서는 노드 서버에서 무엇을 보내야합니까? 이제 res.status (200) 만 전송합니다.
메서드가 없거나 호출되지 않았습니까? 오류 메시지가 나타 납니까? –
메서드가 호출되지 않습니다. 나는 Visual Studio를 사용합니다. onError와 onFailure에 디버그 포인트를 두었고 localhost 서버를 중지 할 때 –
을 누르지 않으면 OnFailure가 호출됩니다. 따라서 오류 콜백이 작동하고 있습니다. 그러나 성공 콜백 NoError는 그렇지 않습니다. –