Skip to content

Commit

Permalink
Step 14.10: Create PartyRsvp 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 8d6967e commit aebe646
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions imports/ui/components/partyRsvp/partyRsvp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import angular from 'angular';
import angularMeteor from 'angular-meteor';

import { Meteor } from 'meteor/meteor';

import template from './partyRsvp.html';

class PartyRsvp {
yes() {
this.answer('yes');
}

maybe() {
this.answer('maybe');
}

no() {
this.answer('no');
}

answer(answer) {
Meteor.call('rsvp', this.party._id, answer, (error) => {
if (error) {
console.error('Oops, unable to rsvp!');
} else {
console.log('RSVP done!')
}
});
}
}

const name = 'partyRsvp';

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

0 comments on commit aebe646

Please sign in to comment.