Ignore:
Timestamp:
11/29/21 22:35:07 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
84d0fbb
Parents:
8d391a1
Message:

spring security

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" >
    21  <div mat-dialog-content>
    32    <p>Planner name</p>
     
    1211  </div>
    1312  <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>
    1615  </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';
     1import { Component, OnInit } from '@angular/core';
     2import { DynamicDialogRef } from 'primeng/dynamicdialog';
    73import { PlannerDto } from '../_models/dto/plannerDto';
    84import { Planner } from '../_models/planner';
    9 import { PlannerService } from '../_services/planner.service';
    105
    116@Component({
     
    1712
    1813  planner: Planner;
    19   planners: Planner[];
    2014  plannerDto: PlannerDto;
    2115
    22   constructor(private dialogRef: MatDialogRef<CreateInitialPlannerComponent>,
    23               private plannerService : PlannerService, private router : Router) {
     16  constructor( private ref: DynamicDialogRef) {
    2417                this.planner = new Planner;
    25                 this.planners = [];
    2618                this.plannerDto = new PlannerDto();
    2719              }
     
    3224  }
    3325
    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();
    4829  }
    4930
Note: See TracChangeset for help on using the changeset viewer.