Permalink
Browse files

Step 19.11: Inject user and import styles into the form

  • Loading branch information...
1 parent 3941804 commit ab7785bfeb3f0ede348439700d7769078201fe7c @dotansimha dotansimha committed with DAB0mB Oct 29, 2016
Showing with 13 additions and 5 deletions.
  1. +13 −5 client/imports/app/parties/parties-form.component.ts
@@ -1,17 +1,19 @@
import { Component, OnInit } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
-import { Meteor } from 'meteor/meteor';
-
import { Parties } from '../../../../both/collections/parties.collection';
-
+import { InjectUser } from "angular2-meteor-accounts-ui";
import template from './parties-form.component.html';
+import style from './parties-form.component.scss';
@Component({
selector: 'parties-form',
- template
+ template,
+ styles: [ style ]
})
+@InjectUser("user")
export class PartiesFormComponent implements OnInit {
addForm: FormGroup;
+ newPartyPosition: {lat:number, lng: number} = {lat: 37.4292, lng: -122.1381};
constructor(
private formBuilder: FormBuilder
@@ -26,6 +28,10 @@ export class PartiesFormComponent implements OnInit {
});
}
+ mapClicked($event) {
+ this.newPartyPosition = $event.coords;
+ }
+
addParty(): void {
if (!Meteor.userId()) {
alert('Please log in to add a party');
@@ -37,7 +43,9 @@ export class PartiesFormComponent implements OnInit {
name: this.addForm.value.name,
description: this.addForm.value.description,
location: {
- name: this.addForm.value.location
+ name: this.addForm.value.location,
+ lat: this.newPartyPosition.lat,
+ lng: this.newPartyPosition.lng
},
public: this.addForm.value.public,
owner: Meteor.userId()

0 comments on commit ab7785b

Please sign in to comment.