@@ -437,6 +437,17 @@ function $RootScopeProvider(){
437
437
this . $root . $$phase = null ;
438
438
} ,
439
439
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
+
440
451
/**
441
452
* @ngdoc function
442
453
* @name angular.module.ng.$rootScope.Scope#$destroy
@@ -445,13 +456,17 @@ function $RootScopeProvider(){
445
456
*
446
457
* @description
447
458
* 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.
451
462
*
452
463
* 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.
454
466
*
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.
455
470
*/
456
471
$destroy : function ( ) {
457
472
if ( this . $root == this ) return ; // we can't remove the root node;
0 commit comments