Skip to content

Commit

Permalink
Step 20.39: Create PartyImage component
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 aedae1b commit 3e2232b
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions imports/ui/components/partyImage/partyImage.js
@@ -0,0 +1,37 @@
import angular from 'angular';
import angularMeteor from 'angular-meteor';

import template from './partyImage.html';
import { Images } from '../../../api/images';

class PartyImage {
constructor($scope, $reactive) {
'ngInject';
$reactive(this).attach($scope);

this.helpers({
mainImage() {
const images = this.getReactively('images', true);
if (images) {
return Images.findOne({
_id: images[0]
});
}
}
});
}
}

const name = 'partyImage';

// create a module
export default angular.module(name, [
angularMeteor
]).component(name, {
template,
bindings: {
images: '<'
},
controllerAs: name,
controller: PartyImage
});

0 comments on commit 3e2232b

Please sign in to comment.