import { Component } from "@angular/core"; import { ConversionInput } from "./conversioninput"; import { ConversionType } from "./conversiontype"; @Component({ selector: "den-inputarea", template: `
` }) export class InputareaComponent { public index:number = 0; 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); switch (this.conversion.type) { case ConversionType.DECODE_BASE64: this.conversion.content = "Base64 decode"; break; case ConversionType.ENCODE_BASE64: this.conversion.content = "Base 64 encode"; break; default: this.conversion.content = "Unknown: " + this.conversion.type; break; } } public setIndex(index:number):void { this.index = index; } }