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,6 +10,7 @@ module todos {
return {
link: ($scope: ng.IScope, element: JQuery, attributes: any) => {
element.bind('blur', () => { $scope.$apply(attributes.todoBlur); });
$scope.$on('$destroy', () => { element.unbind('blur'); });
}
};
}
......
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