
p.location-badge.
  exported from <a href='../core'>angular2/core</a>
  defined in <a href="https://github.com/angular/angular/tree/2.0.0-alpha.37/modules/angular2/src/core/compiler/view_manager.ts#L19-L379">angular2/src/core/compiler/view_manager.ts (line 19)</a>

:markdown
  Entry point for creating, moving views in the view hierarchy and destroying views.
  This manager contains all recursion and delegates to helper methods
  in AppViewManagerUtils and the Renderer, so unit tests get simpler.
  
  

.l-main-section
  h2 Annotations
  .l-sub-section
    h3.annotation Injectable
    pre.prettyprint
      code.
        @Injectable()


.l-main-section
  h2 Members
  .l-sub-section
    h3#getViewContainer getViewContainer

    
    pre.prettyprint
      code.
        getViewContainer(location: ElementRef)
    
    :markdown
      Returns a <a href='ViewContainerRef-interface.html'><code>ViewContainerRef</code></a> at the <a href='ElementRef-class.html'><code>ElementRef</code></a> location.
      
      





  .l-sub-section
    h3#getHostElement getHostElement

    
    pre.prettyprint
      code.
        getHostElement(hostViewRef: HostViewRef)
    
    :markdown
      Return the first child element of the host element view.
      
      





  .l-sub-section
    h3#getNamedElementInComponentView getNamedElementInComponentView

    
    pre.prettyprint
      code.
        getNamedElementInComponentView(hostLocation: ElementRef, variableName: string)
    
    :markdown
      Returns an ElementRef for the element with the given variable name
      in the current view.
      
      - `hostLocation`: <a href='ElementRef-class.html'><code>ElementRef</code></a> of any element in the View which defines the scope of
        search.
      - `variableName`: Name of the variable to locate.
      - Returns <a href='ElementRef-class.html'><code>ElementRef</code></a> of the found element or null. (Throws if not found.)
      
      





  .l-sub-section
    h3#getComponent getComponent

    
    pre.prettyprint
      code.
        getComponent(hostLocation: ElementRef)
    
    :markdown
      Returns the component instance for a given element.
      
      The component is the execution context as seen by an expression at that <a href='ElementRef-class.html'><code>ElementRef</code></a>
      location.
      
      





  .l-sub-section
    h3#createRootHostView createRootHostView

    
    pre.prettyprint
      code.
        createRootHostView(hostProtoViewRef: ProtoViewRef, overrideSelector: string, injector: Injector)
    
    :markdown
      Load component view into existing element.
      
      Use this if a host element is already in the DOM and it is necessary to upgrade
      the element into Angular component by attaching a view but reusing the existing element.
      
      - `hostProtoViewRef`: <a href='ProtoViewRef-interface.html'><code>ProtoViewRef</code></a> Proto view to use in creating a view for this
        component.
      - `overrideSelector`: (optional) selector to use in locating the existing element to load
        the view into. If not specified use the selector in the component definition of the
        `hostProtoView`.
      - injector: <a href='Injector-class.html'><code>Injector</code></a> to use as parent injector for the view.
      
      See <a href='AppViewManager-interface.html#destroyRootHostView'><code>AppViewManager</code></a>.
      
      
      
      ```
      @ng.Component({
        selector: 'child-component'
      })
      @ng.View({
        template: 'Child'
      })
      class ChildComponent {
      
      }
      
      @ng.Component({
        selector: 'my-app'
      })
      @ng.View({
        template: `
          Parent (<some-component></some-component>)
        `
      })
      class MyApp {
        viewRef: ng.ViewRef;
      
        constructor(public appViewManager: ng.AppViewManager, compiler: ng.Compiler) {
          compiler.compileInHost(ChildComponent).then((protoView: ng.ProtoViewRef) => {
            this.viewRef = appViewManager.createRootHostView(protoView, 'some-component', null);
          })
        }
      
        onDestroy() {
          this.appViewManager.destroyRootHostView(this.viewRef);
          this.viewRef = null;
        }
      }
      
      ng.bootstrap(MyApp);
      ```
      
      





  .l-sub-section
    h3#destroyRootHostView destroyRootHostView

    
    pre.prettyprint
      code.
        destroyRootHostView(hostViewRef: HostViewRef)
    
    :markdown
      Remove the View created with <a href='AppViewManager-interface.html#createRootHostView'><code>AppViewManager</code></a>.
      
      





  .l-sub-section
    h3#createEmbeddedViewInContainer createEmbeddedViewInContainer

    
    pre.prettyprint
      code.
        createEmbeddedViewInContainer(viewContainerLocation: ElementRef, atIndex: number, templateRef: TemplateRef)
    
    :markdown
      See <a href='AppViewManager-interface.html#destroyViewInContainer'><code>AppViewManager</code></a>.
      
      





  .l-sub-section
    h3#createHostViewInContainer createHostViewInContainer

    
    pre.prettyprint
      code.
        createHostViewInContainer(viewContainerLocation: ElementRef, atIndex: number, protoViewRef: ProtoViewRef, imperativelyCreatedInjector: ResolvedBinding[])
    
    :markdown
      See <a href='AppViewManager-interface.html#destroyViewInContainer'><code>AppViewManager</code></a>.
      
      





  .l-sub-section
    h3#destroyViewInContainer destroyViewInContainer

    
    pre.prettyprint
      code.
        destroyViewInContainer(viewContainerLocation: ElementRef, atIndex: number)
    
    :markdown
      See <a href='AppViewManager-interface.html#createViewInContainer'><code>AppViewManager</code></a>.
      
      





  .l-sub-section
    h3#attachViewInContainer attachViewInContainer

    
    pre.prettyprint
      code.
        attachViewInContainer(viewContainerLocation: ElementRef, atIndex: number, viewRef: ViewRef)
    
    :markdown
      See <a href='AppViewManager-interface.html#detachViewInContainer'><code>AppViewManager</code></a>.
      
      





  .l-sub-section
    h3#detachViewInContainer detachViewInContainer

    
    pre.prettyprint
      code.
        detachViewInContainer(viewContainerLocation: ElementRef, atIndex: number)
    
    :markdown
      See <a href='AppViewManager-interface.html#attachViewInContainer'><code>AppViewManager</code></a>.
      
      




