angular4 example

by 1004lucifer

HTML

<script src="https://unpkg.com/[email protected]/client/shim.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/zone.min.js"></script>
<script src="https://unpkg.com/[email protected]/bundles/Rx.min.js"></script>
<script src="https://unpkg.com/@angular/[email protected]/bundles/core.umd.js"></script>
<script src="https://unpkg.com/@angular/[email protected]/bundles/common.umd.js"></script>
<script src="https://unpkg.com/@angular/[email protected]/bundles/compiler.umd.js"></script>
<script src="https://unpkg.com/@angular/[email protected]/bundles/platform-browser.umd.js"></script>
<script src="https://unpkg.com/@angular/[email protected]/bundles/platform-browser-dynamic.umd.js"></script>
<my-app></my-app>

TypeScript

let { Component, NgModule } = ng.core;
@Component({
  selector: 'my-app',
  template: `
  	<h1>{{ nowDate | date:'yyyy-mm-dd HH:mm:ss'}}</h1>
  `,
})
class HomeComponent {
		counter = 0;
    nowDate = new Date();
}

const { LOCALE_ID, NgModule } = ng.core;
const { BrowserModule } = ng.platformBrowser;
@NgModule({
  imports:      [ BrowserModule ],
  declarations: [ HomeComponent ],
  providers: [ { provide: LOCALE_ID, useValue: 'ko' } ],
  bootstrap:    [ HomeComponent ]
})
class AppModule { }

const { platformBrowserDynamic } = ng.platformBrowserDynamic;
platformBrowserDynamic().bootstrapModule(AppModule);