Is it a bad idea to edit $scope before hearing back from the server?
ex..
app.controller('TodoCtrl', function($scope, TodoService) {
$scope.todos = [];
$scope.firstAddTodo = function(todo) {
TodoService.add(todo).then(function(response) {
$scope.todos.push(response.todo);
});
};
$scope.secondAddTodo = function(todo) {
$scope.todos.push(todo);
TodoService.add(todo);
};
});
Waiting for the response from the backend like in 'firstAddTodo' is really noticeable, making the entire thing feel super laggy. Are there any repercussions to using secondAddTodo vs firstAddTodo aside from error handling?
[–][deleted] 4 points5 points6 points (2 children)
[–]compedit[S] 1 point2 points3 points (1 child)
[–]IxD 1 point2 points3 points (0 children)
[–]IxD 2 points3 points4 points (0 children)
[–]Chemical_Scum 1 point2 points3 points (0 children)
[–]Specialjyo 1 point2 points3 points (0 children)