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

Commit 78a6291

Browse files
committed
docs(scope): add $destroy event docs
1 parent 53b6f52 commit 78a6291

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

Diff for: src/service/scope.js

+19-4
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,17 @@ function $RootScopeProvider(){
437437
this.$root.$$phase = null;
438438
},
439439

440+
441+
/**
442+
* @ngdoc event
443+
* @name angular.module.$rootScope.Scope#$destroy
444+
* @eventOf angular.module.ng.$rootScope.Scope
445+
* @eventType broadcast on scope being destroyed
446+
*
447+
* @description
448+
* Broadcasted when a scope and its children are being destroyed.
449+
*/
450+
440451
/**
441452
* @ngdoc function
442453
* @name angular.module.ng.$rootScope.Scope#$destroy
@@ -445,13 +456,17 @@ function $RootScopeProvider(){
445456
*
446457
* @description
447458
* Remove the current scope (and all of its children) from the parent scope. Removal implies
448-
* that calls to {@link angular.module.ng.$rootScope.Scope#$digest $digest()} will no longer propagate to the current
449-
* scope and its children. Removal also implies that the current scope is eligible for garbage
450-
* collection.
459+
* that calls to {@link angular.module.ng.$rootScope.Scope#$digest $digest()} will no longer
460+
* propagate to the current scope and its children. Removal also implies that the current
461+
* scope is eligible for garbage collection.
451462
*
452463
* The `$destroy()` is usually used by directives such as
453-
* {@link angular.module.ng.$compileProvider.directive.ng-repeat ng-repeat} for managing the unrolling of the loop.
464+
* {@link angular.module.ng.$compileProvider.directive.ng-repeat ng-repeat} for managing the
465+
* unrolling of the loop.
454466
*
467+
* Just before a scope is destroyed a `$destroy` event is broadcasted on this scope.
468+
* Application code can register a `$destroy` event handler that will give it chance to
469+
* perform any necessary cleanup.
455470
*/
456471
$destroy: function() {
457472
if (this.$root == this) return; // we can't remove the root node;

0 commit comments

Comments
 (0)