Created
March 24, 2016 16:28
-
-
Save alvipeo/1d855e14c64a3f0203c3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
System.config({ | |
//use typescript for compilation | |
transpiler: 'typescript', | |
//typescript compiler options | |
typescriptOptions: { | |
emitDecoratorMetadata: true | |
}, | |
//map tells the System loader where to look for things | |
map: { | |
app: './src' | |
}, | |
//packages defines our app package | |
packages: { | |
app: { | |
main: './main.ts', | |
defaultExtension: 'ts' | |
} | |
} | |
}); |
This file contains hidden or 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 lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>playground</title> | |
<link rel="stylesheet" href="styles.css"> | |
<script src="https://code.angularjs.org/2.0.0-beta.9/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.9/Rx.js"></script> | |
<script src="https://code.angularjs.org/2.0.0-beta.9/angular2.dev.js"></script> | |
<script src="https://code.angularjs.org/2.0.0-beta.9/http.dev.js"></script> | |
<script src="https://code.angularjs.org/2.0.0-beta.9/router.dev.js"></script> | |
<script> | |
System.import('app') | |
.catch(console.error.bind(console)); | |
</script> | |
</head> | |
<body> | |
<app></app> | |
</body> | |
</html> |
This file contains hidden or 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} from 'angular2/core'; | |
import {bootstrap} from 'angular2/platform/browser'; | |
import {Observable} from 'rxjs/Rx'; | |
@Component({ | |
selector: 'app', | |
template: `<div></div>` | |
}) | |
export class App { | |
constructor(){ | |
let o1$ = Observable.range(1,2); | |
let o2$ = Observable.interval(500).take(5); | |
let o$ = Observable | |
.zip(o1$, o2$) | |
.switchMap((x, i) => { | |
console.log("x = ", x, " i=", i); | |
return Observable.range(x[1], i+1); | |
}) | |
; | |
o$.subscribe(x => console.log(x), | |
err => console.error(err), | |
() => console.log("completed")); | |
} | |
} | |
bootstrap(App, []); |
This file contains hidden or 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
/* todo: add styles */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment