Skip to content

Commit

Permalink
Step 21.32: Handle file upload
Browse files Browse the repository at this point in the history
  • Loading branch information
dotansimha authored and DAB0mB committed Dec 14, 2016
1 parent 76a36af commit 9845f15
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion client/imports/app/parties/parties-upload.component.ts
Expand Up @@ -17,6 +17,7 @@ import {Thumbs} from "../../../../both/collections/images.collection";
export class PartiesUploadComponent implements OnInit {
fileIsOver: boolean = false;
uploading: boolean = false;
filesArray: string[] = [];
files: Subject<string[]> = new Subject<string[]>();
thumbsSubscription: Subscription;
thumbs: Observable<Thumb[]>;
Expand Down Expand Up @@ -51,12 +52,18 @@ export class PartiesUploadComponent implements OnInit {
this.uploading = true;

upload(file)
.then(() => {
.then((result) => {
this.uploading = false;
this.addFile(result);
})
.catch((error) => {
this.uploading = false;
console.log(`Something went wrong!`, error);
});
}

addFile(file) {
this.filesArray.push(file._id);
this.files.next(this.filesArray);
}
}

0 comments on commit 9845f15

Please sign in to comment.