Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
docs(scope): add $destroy event docs
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorMinar committed Mar 16, 2012
1 parent 53b6f52 commit 78a6291
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/service/scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,17 @@ function $RootScopeProvider(){
this.$root.$$phase = null;
},


/**
* @ngdoc event
* @name angular.module.$rootScope.Scope#$destroy
* @eventOf angular.module.ng.$rootScope.Scope
* @eventType broadcast on scope being destroyed
*
* @description
* Broadcasted when a scope and its children are being destroyed.
*/

/**
* @ngdoc function
* @name angular.module.ng.$rootScope.Scope#$destroy
Expand All @@ -445,13 +456,17 @@ function $RootScopeProvider(){
*
* @description
* Remove the current scope (and all of its children) from the parent scope. Removal implies
* that calls to {@link angular.module.ng.$rootScope.Scope#$digest $digest()} will no longer propagate to the current
* scope and its children. Removal also implies that the current scope is eligible for garbage
* collection.
* that calls to {@link angular.module.ng.$rootScope.Scope#$digest $digest()} will no longer
* propagate to the current scope and its children. Removal also implies that the current
* scope is eligible for garbage collection.
*
* The `$destroy()` is usually used by directives such as
* {@link angular.module.ng.$compileProvider.directive.ng-repeat ng-repeat} for managing the unrolling of the loop.
* {@link angular.module.ng.$compileProvider.directive.ng-repeat ng-repeat} for managing the
* unrolling of the loop.
*
* Just before a scope is destroyed a `$destroy` event is broadcasted on this scope.
* Application code can register a `$destroy` event handler that will give it chance to
* perform any necessary cleanup.
*/
$destroy: function() {
if (this.$root == this) return; // we can't remove the root node;
Expand Down

0 comments on commit 78a6291

Please sign in to comment.