Mercurial > hg > ng2-query-ismi
changeset 0:39ec75917ef7
first checkin
author | casties |
---|---|
date | Thu, 07 Jan 2016 15:04:15 +0100 |
parents | |
children | 59b7c3afcc6b |
files | .hgignore app/app.component.ts app/boot.ts app/query-select.component.ts index.html package.json tsconfig.json |
diffstat | 7 files changed, 130 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Thu Jan 07 15:04:15 2016 +0100 @@ -0,0 +1,5 @@ + +syntax: regexp +^node_modules$ +syntax: regexp +^\.project$ \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/app.component.ts Thu Jan 07 15:04:15 2016 +0100 @@ -0,0 +1,17 @@ +import {Component} from 'angular2/core'; + +import {QuerySelectComponent} from './query-select.component'; + +@Component({ + selector: 'my-text', + template: ` + <h1>My Angular 2 Text: {{title}}</h1> + <p>Selected option: {{selectedOption}}</p> + <query-select [selectedOption]="selectedOption"></query-select> + `, + directives: [QuerySelectComponent] +}) +export class AppComponent { + public title = 'huhu!'; + public selectedOption = 'unknown'; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/boot.ts Thu Jan 07 15:04:15 2016 +0100 @@ -0,0 +1,4 @@ +import {bootstrap} from 'angular2/platform/browser' +import {AppComponent} from './app.component' + +bootstrap(AppComponent);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/query-select.component.ts Thu Jan 07 15:04:15 2016 +0100 @@ -0,0 +1,31 @@ +import {Component} from 'angular2/core'; + +@Component({ + selector: 'query-select', + template: ` + <p>Selected option: {{selectedQuery}}</p> + <select (change)="onSelectType($event)"> + <option *ngFor="#option of queryTypes" [value]="option"> + {{option}} + </option> + </select> + <select [(ngModel)]="selectedQuery"> + <option *ngFor="#option of query2Types" [value]="option"> + {{option}} + </option> + </select> + ` +}) +export class QuerySelectComponent { + public queryTypes = ['Object type is', 'Attribute contains']; + public selectedQuery = 'unknown'; + public query2Types = ['a', 'b', 'c']; + + onSelectType(event: any) { + var selected = event.target.value + this.selectedQuery = selected; + if (selected == 'Attribute contains') { + this.query2Types = ['d', 'e', 'f']; + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/index.html Thu Jan 07 15:04:15 2016 +0100 @@ -0,0 +1,33 @@ +<html> + + <head> + <title>Angular 2 QuickStart</title> + + <!-- 1. Load libraries --> + <script src="node_modules/angular2/bundles/angular2-polyfills.js"></script> + <script src="node_modules/systemjs/dist/system.src.js"></script> + <script src="node_modules/rxjs/bundles/Rx.js"></script> + <script src="node_modules/angular2/bundles/angular2.dev.js"></script> + + <!-- 2. Configure SystemJS --> + <script> + System.config({ + packages: { + app: { + format: 'register', + defaultExtension: 'js' + } + } + }); + System.import('app/boot') + .then(null, console.error.bind(console)); + </script> + + </head> + + <!-- 3. Display the application --> + <body> + <my-text>Loading...</my-text> + </body> + +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package.json Thu Jan 07 15:04:15 2016 +0100 @@ -0,0 +1,25 @@ +{ + "name": "angular2-quickstart", + "version": "1.0.0", + "scripts": { + "tsc": "tsc", + "tsc:w": "tsc -w", + "lite": "lite-server", + "start": "concurrent \"npm run tsc:w\" \"npm run lite\" " + }, + "license": "ISC", + "dependencies": { + "angular2": "2.0.0-beta.0", + "systemjs": "0.19.6", + "es6-promise": "^3.0.2", + "es6-shim": "^0.33.3", + "reflect-metadata": "0.1.2", + "rxjs": "5.0.0-beta.0", + "zone.js": "0.5.10" + }, + "devDependencies": { + "concurrently": "^1.0.0", + "lite-server": "^1.3.1", + "typescript": "^1.7.3" + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tsconfig.json Thu Jan 07 15:04:15 2016 +0100 @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "ES5", + "module": "system", + "moduleResolution": "node", + "sourceMap": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "removeComments": false, + "noImplicitAny": false + }, + "exclude": [ + "node_modules" + ] +}