<!DOCTYPE html>
<html>
  <head>
    <title>ViewEncapsulation Demo</title>
    <link rel="stylesheet" href="style.css" />
    <script src="https://code.angularjs.org/2.0.0-beta.8/angular2-polyfills.js"></script>
    <script src="https://code.angularjs.org/tools/system.js"></script>
    <script src="https://code.angularjs.org/tools/typescript.js"></script>
    <script src="config.js"></script>
    <script src="https://code.angularjs.org/2.0.0-beta.8/Rx.js"></script>
    <script src="https://code.angularjs.org/2.0.0-beta.8/angular2.dev.js"></script>
    <script>
    System
      .import('app')
      .catch(console.error.bind(console));
    </script>
    <style>
      .test {background: green;}
    </style>
  </head>
  <body>
    <div class="test">Test!</div>
    <my-app>
      Loading...
    </my-app>
  </body>
</html>
/* Styles go here */

System.config({
  transpiler: 'typescript',
  typescriptOptions: {
    emitDecoratorMetadata: true
  },
  map: {
    app: './app'
  },
  packages: {
    app: {
      main: './main.ts',
      defaultExtension: 'ts'
    }
  }
});
import {bootstrap} from 'angular2/platform/browser';
import {AppComponent} from './app.component';

bootstrap(AppComponent);
import {Component, ViewEncapsulation} from 'angular2/core';

@Component({
  selector: 'my-app',
  encapsulation: ViewEncapsulation.Native,
  styles: [`
    :host {
      display: block;
      padding: 10px;
      background: red;
    }
  `],
  template: `
    <div class="test">
      <div>
        Title: {{ title }}
      </div>
      <input type="text" [(ngModel)]="title">
    </div>
  `
})
export class AppComponent {
  public title = 'Hello!';
}