# Created by .ignore support plugin (hsz.mobi)
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff:
.idea/
## File-based project format:
*.iws
## Plugin-specific files:
# IntelliJ
/out/
### Node template
# Logs
logs
*.log
npm-debug.log*
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules
jspm_packages
# Optional npm cache directory
.npm
# Optional REPL history
.node_repl_history
import {Component} from "@angular/core";
import { trigger, state, style, transition, animate, keyframes} from "@angular/animations";
@Component({
selector: 'app',
animations:[
trigger('signal', [
state('void', style({
'transform':'translateY(-100%)'
})),
state('go', style({
'background-color':'green',
'height':'100px'
})),
state('stop', style({
'background-color':'red',
'height':'50px'
})),
transition('void => *', animate(8000, keyframes([
style({'transform':'scale(0)'}),
style({'transform':'scale(.1)'}),
style({'transform':'scale(.9)'}),
style({'transform':'scale(1)'})
]))),
transition('* => *', animate('2s 1s cubic-bezier(0.175, 0.885, 0.32, 1.275)'))
])
],
styles:[`
.traffic-light{
width: 100px;
height: 100px;
background-color: black;
}
`],
template: `
<div
[@signal]="signal"
class="traffic-light"
*ngIf="isHere"
>
</div>
<button (click)="onGoClick()">Go</button>
<button (click)="onStopClick()">Stop</button>
<hr>
<button (click)="onToggleClick()">Toggle</button>
`
})
export class AppComponent {
signal;
isHere = false;
onGoClick(){
this.signal = 'go';
}
onStopClick(){
this.signal = 'stop';
}
onToggleClick(){
this.isHere = !this.isHere;
}
}
export class AppModule { }
import {BrowserModule} from "@angular/platform-browser";
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import {AppComponent} from "./app.component";
import {NgModule} from "@angular/core";
@NgModule({
imports:[
BrowserModule,
BrowserAnimationsModule],
declarations:[AppComponent],
bootstrap:[AppComponent]
})
export class AppModule{}
import {platformBrowserDynamic} from "@angular/platform-browser-dynamic";
import {AppModule} from "./app.module";
platformBrowserDynamic().bootstrapModule(AppModule);
<!DOCTYPE html>
<html>
<head>
<title>Angular 2 Lessons</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script>
var path = document.location.href.includes('plnkr')
? './'
: '/';
document.write('<base href="' + path + '"/>');
</script>
<link rel="stylesheet" href="styles.css">
<script src="https://npmcdn.com/es6-shim@0.35.0/es6-shim.min.js"></script>
<script src="https://npmcdn.com/zone.js@0.6.23?main=browser"></script>
<script src="https://npmcdn.com/reflect-metadata@0.1.3"></script>
<script src="https://npmcdn.com/systemjs@0.19.27/dist/system.src.js"></script>
<script src="systemjs.config.js"></script>
<script>
System.import('app').catch(function(err){ console.error(err); });
</script>
</head>
<body>
<app>Loading...</app>
</body>
</html>
{
"name": "angular2-lessons",
"version": "1.0.1",
"description": "Angular 2 Lessons",
"scripts": {
"start": "echo 'These node packages are only for tooling/IDE. This repo is meant for online demos'",
"live-server": "live-server --entry-file=index.html"
},
"contributors": [
"John Lindquist"
],
"license": "MIT",
"dependencies": {
"@angular/common": "2.0.0-rc.6",
"@angular/compiler": "2.0.0-rc.6",
"@angular/core": "2.0.0-rc.6",
"@angular/forms": "2.0.0-rc.6",
"@angular/http": "2.0.0-rc.6",
"@angular/platform-browser": "2.0.0-rc.6",
"@angular/platform-browser-dynamic": "2.0.0-rc.6",
"@angular/router": "3.0.0-rc.2",
"@angular/upgrade": "2.0.0-rc.6",
"systemjs": "0.19.27",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.11",
"zone.js": "^0.6.17",
"angular2-in-memory-web-api": "0.0.18",
"bootstrap": "^3.3.6"
},
"devDependencies": {
"typescript": "^1.8.10",
"typings": "^1.0.4"
},
"repository": {
"type": "git",
"url": "git+https://github.com/johnlindquist/angular2-lessons.git"
},
"bugs": {
"url": "https://github.com/johnlindquist/angular2-lessons/issues"
},
"homepage": "https://github.com/johnlindquist/angular2-lessons#readme"
}
:root{
font-family: Arial;
}
/**
* 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: {
// Complete copy of compiler options in standard tsconfig.json
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [ "es2015", "dom" ],
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": true,
"sourceMap": true,
"suppressImplicitAnyIndexErrors": true,
"target": "es5"
},
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@4.2.2/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common@4.2.2/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler@4.2.2/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser@4.2.2/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic@4.2.2/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http@4.2.2/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router@4.2.2/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms@4.2.2/bundles/forms.umd.js',
'@angular/animations': 'npm:@angular/animations@4.2.2/bundles/animations.umd.js',
'@angular/animations/browser': 'npm:@angular/animations@4.2.2/bundles/animations-browser.umd.js',
'@angular/platform-browser/animations': 'npm:@angular/platform-browser@4.2.2/bundles/platform-browser-animations.umd.js',
// other libraries
'rxjs': 'npm:rxjs@5.0.1',
'ts': 'npm:plugin-typescript@5.2.7/lib/plugin.js',
'typescript': 'npm:typescript@2.2.1/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'
}
}
});
if (!global.noBootstrap) { bootstrap(); }
// Bootstrap the `AppModule`(skip the `app/main.ts` that normally does this)
function bootstrap() {
// Stub out `app/main.ts` so System.import('app') doesn't fail if called in the index.html
System.set(System.normalizeSync('app/main.ts'), System.newModule({ }));
// bootstrap and launch the app (equivalent to standard main.ts)
Promise.all([
System.import('@angular/platform-browser-dynamic'),
System.import('app/app.module')
])
.then(function (imports) {
var platform = imports[0];
var app = imports[1];
platform.platformBrowserDynamic().bootstrapModule(app.AppModule);
})
.catch(function(err){ console.error(err); });
}
})(this);
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
}
}