diff --git a/demo-shell-ng2/app/app.component.html b/demo-shell-ng2/app/app.component.html index e0f76a4d5a..26a5d89061 100644 --- a/demo-shell-ng2/app/app.component.html +++ b/demo-shell-ng2/app/app.component.html @@ -17,7 +17,7 @@ Home (current)
  • - Page 1 + Uploader
  • Page 2 diff --git a/demo-shell-ng2/app/components/page1.view.ts b/demo-shell-ng2/app/components/page1.view.ts index 6da1023bcd..8293fe6321 100644 --- a/demo-shell-ng2/app/components/page1.view.ts +++ b/demo-shell-ng2/app/components/page1.view.ts @@ -1,14 +1,43 @@ import {Component} from "angular2/core"; +import {UPLOAD_DIRECTIVES} from 'ng2-uploader/ng2-uploader'; + @Component({ selector: 'page1-view', template: `
    -

    Page 1

    +

    Upload File

    +
    +
    + +
    + Response: {{ uploadFile | json }} +
    `, - directives: [] + directives: [UPLOAD_DIRECTIVES] }) export class Page1View { + uploadFile: any; + options: Object = { + url: 'http://192.168.99.100:8080/alfresco/service/api/upload', + withCredentials: true, + authToken: btoa('admin:admin'), + authTokenPrefix: 'Basic', + fieldName: 'filedata', + formFields: { + siteid: 'swsdp', + containerid: 'documentLibrary' + } + }; + + handleUpload(data): void { + if (data && data.response) { + data = JSON.parse(data.response); + this.uploadFile = data; + } + } } diff --git a/demo-shell-ng2/index.html b/demo-shell-ng2/index.html index 9a98fafbbd..d562d5c35e 100644 --- a/demo-shell-ng2/index.html +++ b/demo-shell-ng2/index.html @@ -21,16 +21,25 @@ + +