@@ -135,6 +135,7 @@ ngAnnotate.directive "ngAnnotate", ($rootScope, $compile, $http, $q, NGAnnotatio
135135 annotations : " ="
136136 options : " ="
137137 onAnnotate : " ="
138+ onAnnotateDelete : " ="
138139 onAnnotateError : " ="
139140 compile : (tElement , tAttrs , transclude )->
140141
@@ -272,6 +273,7 @@ ngAnnotate.directive "ngAnnotate", ($rootScope, $compile, $http, $q, NGAnnotatio
272273
273274 popup .scope .$reject = ->
274275 removeAnnotation annotation .id , $scope .annotations
276+ $scope .onAnnotateDelete annotation
275277 clearPopups ()
276278 popup .destroy ()
277279
@@ -306,18 +308,22 @@ ngAnnotate.directive "ngAnnotate", ($rootScope, $compile, $http, $q, NGAnnotatio
306308 clearPopups ()
307309 clearTooltips ()
308310
311+ annotation = getAnnotationById $scope .annotations , targetId
309312 popup = new NGAnnotatePopup $rootScope .$new ()
310313 popup .scope .$isNew = false
311- popup .scope .$annotation = getAnnotationById $scope . annotations , targetId
314+ popup .scope .$annotation = annotation
312315 popup .$anchor = $target
313316
314317 popup .scope .$reject = ->
315318 removeAnnotation targetId, $scope .annotations
319+ if typeof ($scope .onAnnotateDelete ) is " function"
320+ $scope .onAnnotateDelete annotation
316321 clearPopups ()
317322 popup .destroy ()
318323
319324 popup .scope .$close = ->
320- $scope .onAnnotate popup .scope .$annotation
325+ if typeof ($scope .onAnnotate ) is " function"
326+ $scope .onAnnotate popup .scope .$annotation
321327 clearPopups ()
322328 popup .destroy ()
323329
0 commit comments