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/
typings/
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 {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);

View file

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

View file

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

View file

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