Last active
December 1, 2017 18:17
-
-
Save johnlindquist/86b223c7a5de4a1e06df to your computer and use it in GitHub Desktop.
Angular 2 Clock
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', | |
'@ngrx/store': 'https://npmcdn.com/@ngrx/[email protected]/dist/index.js' | |
}, | |
//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> | |
<head> | |
<title>angular2 playground</title> | |
<link rel="stylesheet" href="style.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: ` | |
{{clock | async | date:'medium'}} | |
` | |
}) | |
export class App { | |
clock = Observable | |
.interval(1000) | |
.map(()=> new Date()); | |
} | |
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
/* Styles go here */ | |
body{ | |
font-family: sans-serif; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
doesnt work when i use
clock = Observable .interval(1000) .map(()=> new Date(1512151753372));
//converting timestampany reason why