1
1
notes . controller ( 'dashboardCtrl' , function dashboardCtrl ( $scope , $window , $http ) {
2
2
3
3
$scope . editNote = false ;
4
- $scope . createNote = true ;
4
+ $scope . saveNote = true ;
5
5
$http . post ( '/getNote' , { "email" : sessionStorage . user_email } )
6
6
. success ( function ( data ) {
7
7
$scope . notes = data ;
@@ -62,7 +62,7 @@ notes.controller('dashboardCtrl', function dashboardCtrl($scope, $window, $http)
62
62
63
63
$scope . getNoteById = function ( noteId ) {
64
64
$scope . editNote = true ;
65
- $scope . createNote = false ;
65
+ $scope . saveNote = false ;
66
66
$http . post ( '/getNoteById' , { "noteId" : noteId } )
67
67
. success ( function ( data ) {
68
68
$scope . noteId = data [ 0 ] . _id ;
@@ -82,12 +82,19 @@ notes.controller('dashboardCtrl', function dashboardCtrl($scope, $window, $http)
82
82
angular . element ( '#' + $scope . noteId ) . children ( 'h1' ) . html ( $scope . noteHeading ) ;
83
83
angular . element ( '#' + $scope . noteId ) . children ( '#noteBody' ) . html ( $scope . note ) ;
84
84
$scope . editNote = true ;
85
- $scope . createNote = false ;
85
+ $scope . saveNote = false ;
86
86
} )
87
87
. error ( function ( data ) {
88
88
alert ( "Cannot be updated" ) ;
89
89
$scope . editNote = true ;
90
- $scope . createNote = false ;
90
+ $scope . saveNote = false ;
91
91
} ) ;
92
92
}
93
+
94
+ $scope . initializeModal = function ( ) {
95
+ $scope . noteHeading = '' ;
96
+ $scope . note = '' ;
97
+ $scope . editNote = false ;
98
+ $scope . saveNote = true ;
99
+ }
93
100
} ) ;
0 commit comments