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

View file

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

View file

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