Remove event attaching from watcher handler.
Events should be attached once, and having event attaching code within some watcher can cause big memory leaks attaching same handlers more that one time.stable
parent
34952e8258
commit
48cf4edbb3
|
@ -87,9 +87,6 @@ SprintGraphDirective = ->
|
|||
|
||||
link = ($scope, $el, $attrs) ->
|
||||
element = angular.element($el)
|
||||
$scope.$watch 'stats', (value) ->
|
||||
if $scope.stats?
|
||||
redrawChart(element, $scope.stats.days)
|
||||
|
||||
$scope.$on "resize", ->
|
||||
redrawChart(element, $scope.stats.days)
|
||||
|
@ -100,6 +97,11 @@ SprintGraphDirective = ->
|
|||
# fix chart overflow
|
||||
timeout(100, -> redrawChart(element, $scope.stats.days))
|
||||
|
||||
$scope.$watch 'stats', (value) ->
|
||||
if not $scope.stats?
|
||||
return
|
||||
redrawChart(element, $scope.stats.days)
|
||||
|
||||
$scope.$on "$destroy", ->
|
||||
$el.off()
|
||||
|
||||
|
|
Loading…
Reference in New Issue