Created
August 7, 2017 18:53
-
-
Save Tabares/5d5b984432bf794107c78c9766874cd9 to your computer and use it in GitHub Desktop.
Revisions
-
Tabares created this gist
Aug 7, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ # angular 2 basic counter Basic counter in Angular 2. 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ 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: './counter.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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ <!DOCTYPE html> <html> <head> <title>angular 2 basic counter</title> <link rel="stylesheet" href="style.css" /> <script src="https://code.angularjs.org/2.0.0-beta.11/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.11/Rx.js"></script> <script src="https://code.angularjs.org/2.0.0-beta.11/angular2.dev.js"></script> <script src="https://code.angularjs.org/2.0.0-beta.11/http.dev.js"></script> <script src="https://code.angularjs.org/2.0.0-beta.11/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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ import {Component} from 'angular2/core'; import {bootstrap} from 'angular2/platform/browser'; @Component({ selector: 'app', template: ` <button (click)="increment()">Increment</button> <button (click)="decrement()">Decrement</button> <div></div> {{counter}} ` }) export class App { public counter : number = 0; increment(){ this.counter += 1; } decrement(){ this.counter -= 1; } } bootstrap(App, []);