Last active
September 26, 2017 08:58
-
-
Save kirakishin/fbb6ea57c1539e30639c41d3e4a4f316 to your computer and use it in GitHub Desktop.
Angular 4 starter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, NgModule, VERSION } from '@angular/core' | |
import { trigger, state, style, transition, animate } from '@angular/animations' | |
@Component({ | |
selector: 'app-body', | |
template: ` | |
<h2>Hello <span [@brand]="'red'">{{name}}</span> {{version}}</h2> | |
`, | |
animations: [ | |
trigger('brand', [ state('red', style({ color: '#DD0031' })), transition('void <=> *', animate('500ms')) ]) | |
] | |
}) | |
export class AppComponent { | |
private version: string; | |
private name: string; | |
constructor() { | |
this.name = 'Angular' | |
this.version = VERSION.full | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Angular 4</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/typescript/2.1.1/typescript.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/core-js/2.4.1/core.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/zone.js/0.8.4/zone.min.js"></script> | |
<script src="https://unpkg.com/zone.js/dist/long-stack-trace-zone.js"></script> | |
<script src="https://unpkg.com/[email protected]/Reflect.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.41/system.js"></script> | |
<script src="systemjs.config.js"></script> | |
<script> | |
System | |
.import('_main.ts') | |
.catch(console.error.bind(console)); | |
</script> | |
</head> | |
<body> | |
<app-body>Loading ...</app-body> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; | |
import { BrowserModule } from '@angular/platform-browser'; | |
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; | |
import { NgModule } from '@angular/core'; | |
import { CommonModule } from '@angular/common'; | |
import { AppComponent } from './_app.component'; | |
@NgModule({ | |
imports: [ | |
BrowserModule, | |
BrowserAnimationsModule, | |
CommonModule, | |
], | |
declarations: [AppComponent], | |
bootstrap: [AppComponent], | |
providers: [] | |
}) | |
export class AppModule {} | |
platformBrowserDynamic().bootstrapModule(AppModule); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Add Transpiler for Typescript */ | |
System.config({ | |
transpiler: 'typescript', | |
typescriptOptions: { | |
emitDecoratorMetadata: true, | |
experimentalDecorators: true, | |
}, | |
paths: { | |
'npm:': 'https://unpkg.com/' | |
}, | |
packages: { | |
'.': { | |
defaultExtension: 'ts' | |
}, | |
'vendor': { | |
defaultExtension: 'js' | |
} | |
} | |
}); | |
System.config({ | |
map: { | |
'main': 'main.js', | |
'typescript': 'npm:[email protected]/lib/typescript.js', | |
// Angular specific mappings. | |
'@angular/core': 'npm:@angular/[email protected]/bundles/core.umd.js', | |
'@angular/common': 'npm:@angular/[email protected]/bundles/common.umd.js', | |
'@angular/compiler': 'npm:@angular/[email protected]/bundles/compiler.umd.js', | |
'@angular/platform-browser': 'npm:@angular/[email protected]/bundles/platform-browser.umd.js', | |
'@angular/platform-browser/animations': 'npm:@angular/[email protected]/bundles/platform-browser-animations.umd.js', | |
'@angular/platform-browser-dynamic': 'npm:@angular/[email protected]/bundles/platform-browser-dynamic.umd.js', | |
'@angular/http': 'npm:@angular/[email protected]/bundles/http.umd.js', | |
'@angular/router': 'npm:@angular/[email protected]/bundles/router.umd.js', | |
'@angular/forms': 'npm:@angular/[email protected]/bundles/forms.umd.js', | |
'@angular/animations': 'npm:@angular/[email protected]/bundles/animations.umd.js', | |
'@angular/animations/browser': 'npm:@angular/[email protected]/bundles/animations-browser.umd.js', | |
'@angular/core/testing': 'npm:@angular/[email protected]/bundles/core-testing.umd.js', | |
'@angular/common/testing': 'npm:@angular/[email protected]/bundles/common-testing.umd.js', | |
'@angular/compiler/testing': 'npm:@angular/[email protected]/bundles/compiler-testing.umd.js', | |
'@angular/platform-browser/testing': 'npm:@angular/[email protected]/bundles/platform-browser-testing.umd.js', | |
'@angular/platform-browser-dynamic/testing': 'npm:@angular/[email protected]/bundles/platform-browser-dynamic-testing.umd.js', | |
'@angular/http/testing': 'npm:@angular/[email protected]/bundles/http-testing.umd.js', | |
'@angular/router/testing': 'npm:@angular/[email protected]/bundles/router-testing.umd.js', | |
// Rxjs mapping | |
'rxjs': 'npm:rxjs', | |
}, | |
packages: { | |
// Thirdparty barrels. | |
'rxjs': { main: 'index' }, | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment