angular.module('caco.bookmark.crtl', ['caco.bookmark.REST'])
    .controller('BookMarkCrtl', function ($rootScope, $scope, $stateParams, $location, BookMarkREST) {
        $rootScope.module = 'bookmark';

        if ($stateParams.id) {
            BookMarkREST.one({id: $stateParams.id}, function (data) {
                $scope.bookmark = data.response;
            });
        }
        if ($location.path() === '/bookmark') {
            BookMarkREST.all({}, function (data) {
                $scope.bookmarks = data.response;
            });
        }

        $scope.add = function () {
            BookMarkREST.add({}, $scope.newBookmark, function () {
                $location.path('/bookmark');
            });
        };

        $scope.delete = function (id) {
            if (!confirm('Confirm delete')) {
                return;
            }

            BookMarkREST.remove({id: id}, {}, function(data) {
                BookMarkREST.all({}, function (data) {
                    $scope.bookmarks = data.response;
                });
            });
        };

        $scope.edit = function () {
            BookMarkREST.edit({id: $scope.bookmark.id}, $scope.bookmark, function (data) {
                $location.path('/bookmark');
            });
        };
    });
@@ -933,43 +933,150 @@
     
-BookMarkREST.all(%7B%7D, function (data
+if (data.status != 200) %7B%0A                    return;%0A                %7D%0A%0A                for (var i = $scope.bookmarks.length - 1; i %3E= 0; i--
 ) %7B%0A
@@ -1087,32 +1087,36 @@
                 
+if (
 $scope.bookmarks
@@ -1115,32 +1115,138 @@
 ookmarks
- = data.response
+%5Bi%5D.id != id) %7B%0A                        continue;%0A                    %7D%0A%0A                    $scope.bookmarks.splice(i, 1)
 ;%0A      
@@ -1248,34 +1248,32 @@
                %7D
-);
 %0A            %7D);

Save one request on bookmark delete.