Commit d1dd7e35 authored by Sam Saccone's avatar Sam Saccone

typescript-angular: Fix directive memory leak

parent ee1887e2
......@@ -45,6 +45,7 @@ var todos;
return {
link: function ($scope, element, attributes) {
element.bind('blur', function () { $scope.$apply(attributes.todoBlur); });
$scope.$on('$destroy', function () { element.unbind('blur'); });
}
};
}
......
......@@ -10,7 +10,8 @@ module todos {
return {
link: ($scope: ng.IScope, element: JQuery, attributes: any) => {
element.bind('blur', () => { $scope.$apply(attributes.todoBlur); });
$scope.$on('$destroy', () => { element.unbind('blur'); });
}
};
}
}
\ No newline at end of file
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment