saveCallback = function(response) {
                    if (!response.ok){
                        alertify.error("There was an error saving the note");
                        console.error(response);
                        throw response;
                    }

                    detachWindowUnload();

                    //Tags
                    $scope.note._id = response.id;
                    $rootScope.$emit("noteSaved", $scope.note); //Let any number of services know we have saved a note

                    $location.url("/note/" + response.id + "?rev=" + response.rev); //revision number is here only to force angular to reload
                    alertify.success("Note Saved"); //all done. close the notify dialog
                    $scope.$apply();
                }
Callback after successful save to reload note