Changeset 1ad8e64 for trip-planner-front/src/app/create-initial-planner
- Timestamp:
- 11/29/21 22:35:07 (3 years ago)
- Branches:
- master
- Children:
- 84d0fbb
- Parents:
- 8d391a1
- Location:
- trip-planner-front/src/app/create-initial-planner
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner-front/src/app/create-initial-planner/create-initial-planner.component.html
r8d391a1 r1ad8e64 1 <form (ngSubmit)="onFormSubmitPlanner(f)" #f="ngForm" >2 1 <div mat-dialog-content> 3 2 <p>Planner name</p> … … 12 11 </div> 13 12 <div mat-dialog-actions> 14 <button pButton pRipple type=" button" label="Save" [disabled]="!f.form.valid"15 class="p-button-outlined p-button-rounded p-button-help" ></button>13 <button pButton pRipple type="submit" label="Save" 14 class="p-button-outlined p-button-rounded p-button-help" (click)="onFormSubmitPlanner(planner)"></button> 16 15 </div> 17 </form> -
trip-planner-front/src/app/create-initial-planner/create-initial-planner.component.ts
r8d391a1 r1ad8e64 1 import { ResourceLoader } from '@angular/compiler'; 2 import { Route } from '@angular/compiler/src/core'; 3 import { Component, Inject, OnInit } from '@angular/core'; 4 import { NgForm } from '@angular/forms'; 5 import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; 6 import { ActivatedRoute, Params, Router } from '@angular/router'; 1 import { Component, OnInit } from '@angular/core'; 2 import { DynamicDialogRef } from 'primeng/dynamicdialog'; 7 3 import { PlannerDto } from '../_models/dto/plannerDto'; 8 4 import { Planner } from '../_models/planner'; 9 import { PlannerService } from '../_services/planner.service';10 5 11 6 @Component({ … … 17 12 18 13 planner: Planner; 19 planners: Planner[];20 14 plannerDto: PlannerDto; 21 15 22 constructor(private dialogRef: MatDialogRef<CreateInitialPlannerComponent>, 23 private plannerService : PlannerService, private router : Router) { 16 constructor( private ref: DynamicDialogRef) { 24 17 this.planner = new Planner; 25 this.planners = [];26 18 this.plannerDto = new PlannerDto(); 27 19 } … … 32 24 } 33 25 34 onCancelClick(): void { 35 this.dialogRef.close(); 36 } 37 38 onFormSubmitPlanner(form: NgForm){ 39 console.log(this.planner); 40 this.plannerService.postInitialPlanner(this.planner).subscribe( 41 data=>{ 42 console.log(data); 43 this.router.navigate(['planner']); 44 }, 45 error => console.log('oops', error) 46 ); 47 window.location.reload(); 26 onFormSubmitPlanner(planner){ 27 this.ref.close(planner); 28 window.location.reload(); 48 29 } 49 30
Note:
See TracChangeset
for help on using the changeset viewer.