(XLSX.utils.sheet_to_json(ws, {header:1})));
+ };
+ reader.readAsBinaryString(target.files[0]);
+ }
+
+ export():void {
+ /* generate worksheet */
+ const ws = XLSX.utils.aoa_to_sheet(this.data);
+
+ /* generate workbook and add the worksheet */
+ const wb = XLSX.utils.book_new();
+ XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
+
+ /* save to file */
+ const wbout = XLSX.write(wb, this.wopts);
+ console.log(this.fileName);
+ saveAs(new Blob([s2ab(wbout)]), this.fileName);
+ }
+}
diff --git a/demos/angular2/src/index.html b/demos/angular2/src/index.html
new file mode 100644
index 0000000..bc806fb
--- /dev/null
+++ b/demos/angular2/src/index.html
@@ -0,0 +1,30 @@
+
+
+
+
+
+ SheetJS + Angular 2+
+
+
+
+
+
+
+SheetJS + Angular 2+ demo
+
+The core library can be used as-is in angular applications.
+The Community Edition README details some common use cases.
+We also have some more public demos
+
+This demo shows `SheetJSComponent` which provides:
+- File input button with an event handler to parse the workbook
+- `data` property: array of arrays
+- Simple angular table which binds to the `data` property
+- `export` function that exports the `data` property to a new file.
+
+Sample Spreadsheet
+
+
+
+
+
diff --git a/demos/angular2/src/main.ts b/demos/angular2/src/main.ts
new file mode 100644
index 0000000..d3da1bb
--- /dev/null
+++ b/demos/angular2/src/main.ts
@@ -0,0 +1,3 @@
+import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
+import { AppModule } from './app/app.module';
+platformBrowserDynamic().bootstrapModule(AppModule);
diff --git a/demos/angular2/src/polyfills.ts b/demos/angular2/src/polyfills.ts
new file mode 100644
index 0000000..67478c2
--- /dev/null
+++ b/demos/angular2/src/polyfills.ts
@@ -0,0 +1,3 @@
+import 'core-js/es6/reflect';
+import 'core-js/es7/reflect';
+import 'zone.js/dist/zone';
\ No newline at end of file
diff --git a/demos/angular2/src/tsconfig.app.json b/demos/angular2/src/tsconfig.app.json
new file mode 100644
index 0000000..321e0d7
--- /dev/null
+++ b/demos/angular2/src/tsconfig.app.json
@@ -0,0 +1,9 @@
+{
+ "extends": "../tsconfig.json",
+ "compilerOptions": {
+ "outDir": "../out-tsc/app",
+ "module": "es2015",
+ "baseUrl": "",
+ "types": []
+ }
+}
diff --git a/demos/angular2/tsconfig.json b/demos/angular2/tsconfig.json
new file mode 100644
index 0000000..a35a8ee
--- /dev/null
+++ b/demos/angular2/tsconfig.json
@@ -0,0 +1,20 @@
+{
+ "compileOnSave": false,
+ "compilerOptions": {
+ "outDir": "./dist/out-tsc",
+ "baseUrl": "src",
+ "sourceMap": true,
+ "declaration": false,
+ "moduleResolution": "node",
+ "emitDecoratorMetadata": true,
+ "experimentalDecorators": true,
+ "target": "es5",
+ "typeRoots": [
+ "node_modules/@types"
+ ],
+ "lib": [
+ "es2016",
+ "dom"
+ ]
+ }
+}