select first note in list, after delete

This commit is contained in:
Amit
2017-02-09 00:15:34 +09:00
parent 340a66e481
commit 054eae6adf
2 changed files with 11 additions and 0 deletions

View File

@@ -239,9 +239,16 @@ angular.module('app.frontend')
if(confirm("Are you sure you want to delete this note?")) {
this.remove()(this.note);
this.showMenu = false;
this.notifyDelete();
}
}
this.notifyDelete = function() {
$timeout(function() {
$rootScope.$broadcast("noteDeleted");
}.bind(this), 500);
}
this.clickedEditNote = function() {
this.editorMode = 'edit';
this.focusEditor(100);

View File

@@ -30,6 +30,10 @@ angular.module('app.frontend')
this.showMenu = false;
}.bind(this))
$rootScope.$on("noteDeleted", function() {
this.selectFirstNote(false);
}.bind(this))
var isFirstLoad = true;
this.notesToDisplay = 20;