<!DOCTYPE html>
<html>

  <head>
    <title>Angular static banana test</title>

  <!-- Polyfills -->
    <script src="https://unpkg.com/core-js/client/shim.min.js"></script>

    <script src="https://unpkg.com/zone.js@0.7.4?main=browser"></script>
    <script src="https://unpkg.com/systemjs@0.19.39/dist/system.src.js"></script>
    <script src="systemjs.config.js"></script>

    <script>
    System.import('main.ts').catch(function(err){ console.error(err); });
    </script>

    <link rel="stylesheet" type="text/css" href="styles.css">
  </head>

  <body>
    <app>Loading...</app>
  </body>

</html>
hi!
<banana></banana>

<hr>

<button (click)="createStaticBanana()">Create static banana</button>

import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { App } from './app';
import { BananaComponent } from './banana.component';
@NgModule({
  imports:      [ BrowserModule ],
  declarations: [ App, BananaComponent],
  bootstrap:    [ App ],
})
export class AppModule { }
import {Component, ViewChild} from '@angular/core';
import {BananaComponent} from './banana.component';

@Component({
  selector: 'app',
  templateUrl: 'app/app.html'
})
export class App {
  @ViewChild(BananaComponent) myBanana;
  
  private createStaticBanana(): void {
    
    let bananaHtml = this.myBanana.elementRef.nativeElement.outerHTML;
    
    let bananaCss = [].slice.call(document.styleSheets)
        .map(sheet => [].slice.call(sheet.rules))
        .filter(sheet => !sheet.disabled)
        .reduce((all_rules, rules) => all_rules.concat(rules), [])
        .reduce((style, rule) => `${style}\n${rule.cssText}`, "");
    
    let staticBanana = `
      <!DOCTYPE html>
      <html>
      	<head>
      		<meta charset="utf-8">
      		<style>
      			${bananaCss}
      		</style>
      	</head>
      		<body>
      			${bananaHtml}
      		</body>
      </html>
    `;
      alert(staticBanana);
      // make staticBanana downloadable as html file etc... not relevant here

  }
}

.yellow {
    color:yellow;
    background-color:black;
    font-weight: bold;
}
<p class="yellow">I am a {{whatAmI}}.</p>
import {Component, ElementRef} from '@angular/core';

@Component({
  selector: 'banana',
  templateUrl: 'app/banana.component.html',
  styleUrls: [ 'app/banana.component.css' ]
})
export class BananaComponent {
  private whatAmI: string = "banana";
  
    constructor(public elementRef: ElementRef) { 
        
    }
    
}

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from 'app/app.module';

platformBrowserDynamic().bootstrapModule(AppModule);


/*
Copyright 2017 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/
/**
 * WEB ANGULAR VERSION
 * (based on systemjs.config.js in angular.io)
 * System configuration for Angular samples
 * Adjust as necessary for your application needs.
 */
(function (global) {
  System.config({
    // DEMO ONLY! REAL CODE SHOULD NOT TRANSPILE IN THE BROWSER
    transpiler: 'ts',
    typescriptOptions: {
      // Copy of compiler options in standard tsconfig.json
      "target": "es5",
      "module": "commonjs",
      "moduleResolution": "node",
      "sourceMap": true,
      "emitDecoratorMetadata": true,
      "experimentalDecorators": true,
      "lib": ["es2015", "dom"],
      "noImplicitAny": true,
      "suppressImplicitAnyIndexErrors": true
    },
    meta: {
      'typescript': {
        "exports": "ts"
      }
    },
    paths: {
      // paths serve as alias
      'npm:': 'https://unpkg.com/'
    },
    // map tells the System loader where to look for things
    map: {
      // our app is within the app folder
      app: 'app',

      // angular bundles
      '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
      '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
      '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
      '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
      '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
      '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
      '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
      '@angular/router/upgrade': 'npm:@angular/router/bundles/router-upgrade.umd.js',
      '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
      '@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js',
      '@angular/upgrade/static': 'npm:@angular/upgrade/bundles/upgrade-static.umd.js',

      // other libraries
      'rxjs':                      'npm:rxjs@5.0.1',
      'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
      'ts':                        'npm:plugin-typescript@5.2.7/lib/plugin.js',
      'typescript':                'npm:typescript@2.0.10/lib/typescript.js',

    },
    // packages tells the System loader how to load when no filename and/or no extension
    packages: {
      app: {
        main: './main.ts',
        defaultExtension: 'ts'
      },
      rxjs: {
        defaultExtension: 'js'
      }
    }
  });

})(this);

/*
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/
p {
  text-transform:uppercase;
}