Skip to content

Commit

Permalink
Step 18.33: Create PartyAddButton component
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Kisiela authored and Dotan Simha committed Nov 22, 2016
1 parent f180e87 commit ab434aa
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions imports/ui/components/partyAddButton/partyAddButton.js
@@ -0,0 +1,45 @@
import angular from 'angular';
import angularMeteor from 'angular-meteor';

import buttonTemplate from './partyAddButton.html';
import modalTemplate from './partyAddModal.html';
import { name as PartyAdd } from '../partyAdd/partyAdd';

class PartyAddButton {
constructor($mdDialog, $mdMedia) {
'ngInject';

this.$mdDialog = $mdDialog;
this.$mdMedia = $mdMedia
}

open(event) {
this.$mdDialog.show({
controller($mdDialog) {
'ngInject';

this.close = () => {
$mdDialog.hide();
}
},
controllerAs: 'partyAddModal',
template: modalTemplate,
targetEvent: event,
parent: angular.element(document.body),
clickOutsideToClose: true,
fullscreen: this.$mdMedia('sm') || this.$mdMedia('xs')
});
}
}

const name = 'partyAddButton';

// create a module
export default angular.module(name, [
angularMeteor,
PartyAdd
]).component(name, {
template: buttonTemplate,
controllerAs: name,
controller: PartyAddButton
});

0 comments on commit ab434aa

Please sign in to comment.