
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/metadata/view.ts#L4-L117">angular2/src/core/metadata/view.ts (line 4)</a>

:markdown
  Declares the available HTML templates for an application.
  
  Each Angular component requires a single `@Component` and at least one `@View` annotation. The
  `@View` annotation specifies the HTML template to use, and lists the directives that are active
  within the template.
  
  When a component is instantiated, the template is loaded into the component's shadow root, and
  the expressions and statements in the template are evaluated against the component.
  
  For details on the `@Component` annotation, see <a href='ComponentMetadata-class.html'><code>ComponentMetadata</code></a>.
  
  ## Example
  
  ```
  @Component({
    selector: 'greet'
  })
  @View({
    template: 'Hello {{name}}!',
    directives: [GreetUser, Bold]
  })
  class Greet {
    name: string;
  
    constructor() {
      this.name = 'World';
    }
  }
  ```
  
  

.l-main-section
  h2 Annotations
.l-main-section
  h2 Members
  .l-sub-section
    h3#constructor constructor

    
    pre.prettyprint
      code.
        constructor({templateUrl, template, directives, pipes, encapsulation, styles, styleUrls}?: {
            templateUrl?: string,
            template?: string,
            directives?: Array&lt;Type | any | any[]&gt;,
            pipes?: Array&lt;Type | any | any[]&gt;,
            encapsulation?: ViewEncapsulation,
            styles?: string[],
            styleUrls?: string[],
          })
    
    :markdown




  .l-sub-section
    h3#templateUrl templateUrl

    
    :markdown
      Specifies a template URL for an Angular component.
      
      NOTE: either `templateUrl` or `template` should be used, but not both.
      
      





  .l-sub-section
    h3#template template

    
    :markdown
      Specifies an inline template for an Angular component.
      
      NOTE: either `templateUrl` or `template` should be used, but not both.
      
      





  .l-sub-section
    h3#styleUrls styleUrls

    
    :markdown
      Specifies stylesheet URLs for an Angular component.
      
      





  .l-sub-section
    h3#styles styles

    
    :markdown
      Specifies an inline stylesheet for an Angular component.
      
      





  .l-sub-section
    h3#directives directives

    
    :markdown
      Specifies a list of directives that can be used within a template.
      
      Directives must be listed explicitly to provide proper component encapsulation.
      
      
      
      ```javascript
      @Component({
          selector: 'my-component'
        })
      @View({
        directives: [NgFor]
        template: '
        <ul>
          <li *ng-for="#item of items">{{item}}</li>
        </ul>'
      })
      class MyComponent {
      }
      ```
      
      





  .l-sub-section
    h3#pipes pipes

    
    :markdown





  .l-sub-section
    h3#encapsulation encapsulation

    
    :markdown
      Specify how the template and the styles should be encapsulated.
      The default is <a href='ViewEncapsulation-enum.html#Emulated'>`ViewEncapsulation.Emulated`</a> if the view
      has styles,
      otherwise <a href='ViewEncapsulation-enum.html#None'>`ViewEncapsulation.None`</a>.
      
      




