I am reading this article and then encountered the ondelete concept in directive, which I couldn't find the explanation in official document.
app.directive('stickyNote', function(socket) {
var linker = function(scope, element, attrs) {};
var controller = function($scope) {};
return {
restrict: 'A',
link: linker,
controller: controller,
scope: {
note: '=',
ondelete: '&' // What is ondelete? Where is document?
}
};
});
Can you please help me find the official document to explain ondelete in directive?
答案 0 :(得分:1)
Scope has a $destroy event. You may subscribe on it
$scope.$on('$destroy', function() {...});
答案 1 :(得分:0)
This section of the angular documentation explains what are the different ways of binding scope variables inside a directive to the parent scope.
What that code is doing is a two-way binding with the parent scope variable passed in stickyNote ondelete
property