Changeset 6a80231 for trip-planner-front/src/app/create-initial-planner/create-initial-planner.component.ts
- Timestamp:
- 11/02/21 22:14:57 (3 years ago)
- Branches:
- master
- Children:
- 6c1585f
- Parents:
- 188ee53
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner-front/src/app/create-initial-planner/create-initial-planner.component.ts
r188ee53 r6a80231 1 import { ResourceLoader } from '@angular/compiler'; 2 import { Route } from '@angular/compiler/src/core'; 1 3 import { Component, Inject, OnInit } from '@angular/core'; 4 import { NgForm } from '@angular/forms'; 2 5 import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; 6 import { ActivatedRoute, Params, Router } from '@angular/router'; 7 import { PlannerDto } from '../_models/dto/plannerDto'; 8 import { Planner } from '../_models/planner'; 9 import { PlannerService } from '../_services/planner.service'; 3 10 4 11 @Component({ … … 9 16 export class CreateInitialPlannerComponent implements OnInit { 10 17 11 constructor( 12 public dialogRef: MatDialogRef<CreateInitialPlannerComponent>) {} 18 planner: Planner; 19 planners: Planner[]; 20 locations : Location[]; 21 plannerDto: PlannerDto; 22 23 constructor(public dialogRef: MatDialogRef<CreateInitialPlannerComponent>, 24 private plannerService : PlannerService, private router : Router) { 25 this.planner = new Planner; 26 this.planners = []; 27 this.locations = []; 28 this.plannerDto = new PlannerDto(); 29 } 13 30 14 31 ngOnInit(): void { 32 this.planner = new Planner(); 33 this.plannerDto = new PlannerDto(); 15 34 } 16 35 … … 18 37 this.dialogRef.close(); 19 38 } 39 40 onFormSubmitPlanner(form: NgForm){ 41 console.log(this.planner); 42 this.plannerService.postInitialPlanner(this.plannerDto).subscribe( 43 data=>{ 44 console.log(data); 45 this.router.navigate(['planner']); 46 }, 47 error => console.log('oops', error) 48 ); 49 window.location.reload(); 50 } 51 20 52 21 53 }
Note:
See TracChangeset
for help on using the changeset viewer.