Skip to content

Commit

Permalink
Step 20.15: Handle file selection
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Kisiela authored and DAB0mB committed Dec 14, 2016
1 parent 1a4d644 commit 09eba52
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion imports/ui/components/partyUpload/partyUpload.js
Expand Up @@ -6,7 +6,30 @@ import { Meteor } from 'meteor/meteor';

import template from './partyUpload.html';

class PartyUpload {}
class PartyUpload {
constructor($scope, $reactive) {
'ngInject';

$reactive(this).attach($scope);
}

addImages(files) {
if (files.length) {
this.currentFile = files[0];

const reader = new FileReader;

reader.onload = this.$bindToContext((e) => {
this.cropImgSrc = e.target.result;
this.myCroppedImage = '';
});

reader.readAsDataURL(files[0]);
} else {
this.cropImgSrc = undefined;
}
}
}

const name = 'partyUpload';

Expand Down

0 comments on commit 09eba52

Please sign in to comment.