
p.location-badge.
  exported from <a href='../core'>angular2/core</a>
  defined in <a href="https://github.com/angular/angular/tree/3a0410a/modules/angular2/src/core/zone/ng_zone.ts#L4-L216">angular2/src/core/zone/ng_zone.ts (line 4)</a>

:markdown
  A wrapper around zones that lets you schedule tasks after it has executed a task.
  
  The wrapper maintains an "inner" and an "mount" `Zone`. The application code will executes
  in the "inner" zone unless `runOutsideAngular` is explicitely called.
  
  A typical application will create a singleton `NgZone`. The outer `Zone` is a fork of the root
  `Zone`. The default `onTurnDone` runs the Angular change detection.
  
.l-main-section
  h2 Members
  .l-sub-section
    h3 constructor

    
    pre.prettyprint
      code.
        constructor({enableLongStackTrace})
    
    :markdown
      Associates with this
      
      - a "root" zone, which the one that instantiated this.
      - an "inner" zone, which is a child of the root zone.
      




  .l-sub-section
    h3 initCallbacks

    
    pre.prettyprint
      code.
        initCallbacks({onTurnStart, onTurnDone, onErrorHandler}?: {
        onTurnStart?: /*() =&gt; void*/ Function,
        onTurnDone?: /*() =&gt; void*/ Function,
        onErrorHandler?: /*(error, stack) =&gt; void*/ Function
      })
    
    :markdown

      Initializes the zone hooks.
      





  .l-sub-section
    h3 run

    
    pre.prettyprint
      code.
        run(fn)
    
    :markdown

      Runs `fn` in the inner zone and returns whatever it returns.
      
      In a typical app where the inner zone is the Angular zone, this allows one to make use of the
      Angular's auto digest mechanism.
      
      ```
      var zone: NgZone = [ref to the application zone];
      
      zone.run(() => {
        // the change detection will run after this function and the microtasks it enqueues have
      executed.
      });
      ```
      
      





  .l-sub-section
    h3 runOutsideAngular

    
    pre.prettyprint
      code.
        runOutsideAngular(fn)
    
    :markdown

      Runs `fn` in the outer zone and returns whatever it returns.
      
      In a typical app where the inner zone is the Angular zone, this allows one to escape Angular's
      auto-digest mechanism.
      
      ```
      var zone: NgZone = [ref to the application zone];
      
      zone.runOusideAngular(() => {
        element.onClick(() => {
          // Clicking on the element would not trigger the change detection
        });
      });
      ```
      
      




