Permalink
Browse files

Step 5.11: Add addParty method

1 parent 683564c commit c6668732a1651d00a55961b96b847cce574595ab @kamilkisiela kamilkisiela committed with DAB0mB Sep 21, 2016
Showing with 10 additions and 0 deletions.
  1. +10 −0 client/imports/app/parties/parties-form.component.ts
@@ -1,6 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
+import { Parties } from '../../../../both/collections/parties.collection';
+
import template from './parties-form.component.html';
@Component({
@@ -21,4 +23,12 @@ export class PartiesFormComponent implements OnInit {
location: ['', Validators.required]
});
}
+
+ addParty(): void {
+ if (this.addForm.valid) {
+ Parties.insert(this.addForm.value);
+
+ this.addForm.reset();
+ }
+ }
}

0 comments on commit c666873

Please sign in to comment.