updated to angular-2.0.0 (final)

This commit is contained in:
Manuel Friedli 2016-09-15 12:40:13 +02:00
parent a59ab194c3
commit 0cf6eeaedf
9 changed files with 94 additions and 77 deletions

2
.gitignore vendored
View file

@ -5,4 +5,4 @@ atlassian-ide-plugin.xml
node_modules/ node_modules/
typings/ typings/
app/**/*.js app/**/*.js
app/**/*.js.map app/**/*.js.map

View file

@ -1,7 +1,7 @@
import { Component } from "@angular/core"; import {Component} from "@angular/core";
import { InputareaComponent } from "./inputarea.component"; import {InputareaComponent} from "./inputarea.component";
import {ConversionType} from "./conversiontype"; // import {ConversionType} from "./conversiontype";
//import { SelectorComponent } from "./selector.component"; //import { SelectorComponent } from "./selector.component";
@Component({ @Component({
@ -10,13 +10,12 @@ import {ConversionType} from "./conversiontype";
<div> <div>
<den-inputarea></den-inputarea> <den-inputarea></den-inputarea>
</div> </div>
`, `
directives: [InputareaComponent]
}) })
export class AppComponent { export class AppComponent {
private inputAreas:InputareaComponent[] = []; // private inputAreas:InputareaComponent[] = [];
//
constructor() { // constructor() {
this.inputAreas.push(new InputareaComponent()); // this.inputAreas.push(new InputareaComponent());
} // }
} }

20
app/app.module.ts Normal file
View file

@ -0,0 +1,20 @@
import {NgModule} from '@angular/core'
import {BrowserModule} from '@angular/platform-browser'
import {FormsModule} from '@angular/forms'
import {AppComponent} from './app.component'
import {InputareaComponent} from "./inputarea.component";
@NgModule({
imports: [
BrowserModule,
FormsModule
],
declarations: [
AppComponent,
InputareaComponent
],
bootstrap: [AppComponent]
})
export class AppModule {
}

View file

@ -3,4 +3,4 @@ import { ConversionType} from "./conversiontype";
export class ConversionInput { export class ConversionInput {
public content:string; public content:string;
public type:ConversionType; public type:ConversionType;
} }

View file

@ -20,18 +20,18 @@ export class InputareaComponent {
public conversions:ConversionType[] = [ConversionType.ENCODE_BASE64, ConversionType.DECODE_BASE64]; public conversions:ConversionType[] = [ConversionType.ENCODE_BASE64, ConversionType.DECODE_BASE64];
private conversion:ConversionInput; private conversion:ConversionInput;
private ConversionType:ConversionType = ConversionType; private ConversionType:ConversionType = ConversionType;
constructor() { constructor() {
console.log("Aloha, " + this.index); console.log("Aloha, " + this.index);
this.conversion = new ConversionInput(); this.conversion = new ConversionInput();
this.conversion.content = ""; this.conversion.content = "";
this.conversion.type = ConversionType.DECODE_BASE64; this.conversion.type = ConversionType.DECODE_BASE64;
} }
public update():void { public update():void {
console.log(this.conversion.content); console.log(this.conversion.content);
} }
public convert(e):void { public convert(e):void {
this.conversion.type = ConversionType.of(+e.target.selectedOptions[0].id); this.conversion.type = ConversionType.of(+e.target.selectedOptions[0].id);
console.log(this.conversion.type); console.log(this.conversion.type);
@ -40,14 +40,14 @@ export class InputareaComponent {
this.conversion.content = "Base64 decode"; this.conversion.content = "Base64 decode";
break; break;
case ConversionType.ENCODE_BASE64: case ConversionType.ENCODE_BASE64:
this.conversion.content = "Base 64 encode"; this.conversion.content = "Base64 encode";
break; break;
default: default:
this.conversion.content = "Unknown: " + this.conversion.type; this.conversion.content = "Unknown: " + this.conversion.type;
break; break;
} }
} }
public setIndex(index:number):void { public setIndex(index:number):void {
this.index = index; this.index = index;
} }

View file

@ -1,5 +1,6 @@
import {bootstrap} from "@angular/platform-browser-dynamic"; import {platformBrowserDynamic} from "@angular/platform-browser-dynamic";
import {AppComponent} from "./app.component"; import {AppModule} from "./app.module";
bootstrap(AppComponent); const platform = platformBrowserDynamic();
platform.bootstrapModule(AppModule);

View file

@ -3,7 +3,7 @@
"version": "1.0.0-alpha.1", "version": "1.0.0-alpha.1",
"description": "Convert to and fro!", "description": "Convert to and fro!",
"keywords": [ "keywords": [
"dencode" "dencode", "conversion", "converter", "convert"
], ],
"author": { "author": {
"name": "Manuel Friedli", "name": "Manuel Friedli",
@ -13,25 +13,26 @@
"homepage": "https://test.friedli.info/~manuel/dencode", "homepage": "https://test.friedli.info/~manuel/dencode",
"repository": "https://gittr.ch/manuel/dencode.org.git", "repository": "https://gittr.ch/manuel/dencode.org.git",
"dependencies": { "dependencies": {
"@angular/common": "2.0.0-rc.1", "@angular/common": "2.0.0",
"@angular/compiler": "2.0.0-rc.1", "@angular/compiler": "2.0.0",
"@angular/core": "2.0.0-rc.1", "@angular/core": "2.0.0",
"@angular/platform-browser": "2.0.0-rc.1", "@angular/forms": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0-rc.1", "@angular/platform-browser": "2.0.0",
"@angular/upgrade": "2.0.0-rc.1", "@angular/platform-browser-dynamic": "2.0.0",
"@angular/upgrade": "2.0.0",
"bootstrap": "^3.3.6", "bootstrap": "^3.3.6",
"core-js": "^2.4.0", "core-js": "^2.4.0",
"reflect-metadata": "^0.1.3", "reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6", "rxjs": "5.0.0-beta.12",
"systemjs": "^0.19.27", "systemjs": "^0.19.27",
"zone.js": "^0.6.12" "zone.js": "^0.6.12"
}, },
"devDependencies": { "devDependencies": {
"concurrently": "^2.0.0", "concurrently": "^2.2.0",
"gulp": "^3.9.0", "gulp": "^3.9.0",
"lite-server": "^2.2.0", "lite-server": "^2.2.0",
"typescript": "^1.8.10", "typescript": "^2.0.2",
"typings": "^1.0.4" "typings": "^1.3.2"
}, },
"scripts": { "scripts": {
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\"", "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\"",

View file

@ -2,46 +2,42 @@
* System configuration for Angular 2 samples * System configuration for Angular 2 samples
* Adjust as necessary for your application needs. * Adjust as necessary for your application needs.
*/ */
(function(global) { (function (global) {
// map tells the System loader where to look for things System.config({
var map = { paths: {
'app': 'app', // 'dist', // paths serve as alias
'@angular': 'node_modules/@angular', 'npm:': 'node_modules/'
// 'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api', },
'rxjs': 'node_modules/rxjs' // map tells the System loader where to look for things
}; map: {
// packages tells the System loader how to load when no filename and/or no extension // our app is within the app folder
var packages = { app: 'app',
'app': { main: 'main.js', defaultExtension: 'js' }, // angular bundles
'rxjs': { defaultExtension: 'js' }, '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
// 'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' }, '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
}; '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
var ngPackageNames = [ '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'common', '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'compiler', // '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'core', // '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'http', '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
'platform-browser', // other libraries
'platform-browser-dynamic', 'rxjs': 'npm:rxjs'//,
'router', // 'angular2-in-memory-web-api': 'npm:angular2-in-memory-web-api',
'router-deprecated', },
'upgrade', // packages tells the System loader how to load when no filename and/or no extension
]; packages: {
// Individual files (~300 requests): app: {
function packIndex(pkgName) { main: './main.js',
packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' }; defaultExtension: 'js'
} },
// Bundled (~40 requests): rxjs: {
function packUmd(pkgName) { defaultExtension: 'js'
packages['@angular/'+pkgName] = { main: pkgName + '.umd.js', defaultExtension: 'js' }; },
}; 'angular2-in-memory-web-api': {
// Most environments should use UMD; some (Karma) need the individual index files main: './index.js',
var setPackageConfig = System.packageWithIndex ? packIndex : packUmd; defaultExtension: 'js'
// Add package entries for angular packages }
ngPackageNames.forEach(setPackageConfig); }
var config = { });
map: map,
packages: packages
}
System.config(config);
})(this); })(this);

View file

@ -1,7 +1,7 @@
{ {
"globalDependencies": { "globalDependencies": {
"core-js": "registry:dt/core-js#0.0.0+20160317120654", "core-js": "registry:dt/core-js#0.0.0+20160725163759",
"jasmine": "registry:dt/jasmine#2.2.0+20160505161446", "jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
"node": "registry:dt/node#4.0.0+20160509154515" "node": "registry:dt/node#6.0.0+20160909174046"
} }
} }