Skip to content

Commit da2bff5

Browse files
committed
Added checks that the callbacks actually are defined before calling them
1 parent 90a75e9 commit da2bff5

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

js/src/ng-annotate.coffee

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,9 @@ ngAnnotate.directive "ngAnnotate", ($rootScope, $compile, $http, $q, NGAnnotatio
260260
$scope.$apply()
261261
$span = element.find ".ng-annotation-" + annotation.id
262262
catch ex
263-
$scope.onAnnotateError ex
263+
if $scope.onAnnotateError?
264+
$scope.onAnnotateError ex
265+
264266
return
265267

266268
clearPopups()
@@ -273,12 +275,17 @@ ngAnnotate.directive "ngAnnotate", ($rootScope, $compile, $http, $q, NGAnnotatio
273275

274276
popup.scope.$reject = ->
275277
removeAnnotation annotation.id, $scope.annotations
276-
$scope.onAnnotateDelete annotation
278+
279+
if $scope.onAnnotateDelete?
280+
$scope.onAnnotateDelete annotation
281+
277282
clearPopups()
278283
popup.destroy()
279284

280285
popup.scope.$close = ->
281-
$scope.onAnnotate popup.scope.$annotation
286+
if $scope.onAnnotate?
287+
$scope.onAnnotate popup.scope.$annotation
288+
282289
clearPopups()
283290
popup.destroy()
284291

0 commit comments

Comments
 (0)