- Timestamp:
- 11/25/21 22:08:24 (3 years ago)
- Branches:
- master
- Children:
- 8d391a1
- Parents:
- 59329aa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner-front/src/app/planner/planner.component.ts
r59329aa re29cc2e 2 2 import { Planner } from '../_models/planner'; 3 3 import { PlannerService } from '../_services/planner.service'; 4 import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';5 4 import { CreateInitialPlannerComponent } from '../create-initial-planner/create-initial-planner.component'; 6 5 import { Router } from '@angular/router'; 7 6 import { PlannerDto } from '../_models/dto/plannerDto'; 8 7 import { FormBuilder, FormGroup, Validators } from '@angular/forms'; 8 import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog'; 9 import { PrimeNGConfig } from 'primeng/api'; 9 10 10 11 … … 19 20 plannerDto: PlannerDto; 20 21 editForm: FormGroup; 22 ref: DynamicDialogRef; 21 23 22 24 23 24 constructor(private plannerService: PlannerService, private dialog: MatDialog, private router: Router, 25 private fb : FormBuilder) { 25 constructor(private plannerService: PlannerService, private router: Router, 26 private fb: FormBuilder, private dialogService: DialogService, private primengConfig: PrimeNGConfig) { 26 27 this.planners = []; 27 28 this.plannerDto = new PlannerDto(); 28 29 this.editForm = fb.group({ 29 30 title: fb.control('initial value', Validators.required) 30 });31 };32 33 openDialog(): void {34 const dialogRef = this.dialog.open(CreateInitialPlannerComponent, {35 width: '250px',36 data: {}37 31 }); 32 this.ref = new DynamicDialogRef; 38 33 } 39 34 40 35 ngOnInit(): void { 36 37 this.primengConfig.ripple = true; 38 41 39 this.plannerService.getAllPlanners().subscribe( 42 40 data => { … … 45 43 ); 46 44 } 47 48 onClickEditPlannerGet(id: number) {45 46 onClickEditPlannerGet(id: number) { 49 47 console.log(id); 50 51 data => {52 53 54 55 48 this.plannerService.getPlannerById(id).subscribe( 49 data => { 50 this.router.navigate(['edit/planner/', id]); 51 } 52 ); 53 56 54 } 57 58 55 show() { 56 this.ref = this.dialogService.open(CreateInitialPlannerComponent, { 57 header: 'Create initial planner', 58 width: '70%', 59 contentStyle: { "max-height": "500px", "overflow": "auto" }, 60 baseZIndex: 10000 61 }); 62 } 59 63 }
Note:
See TracChangeset
for help on using the changeset viewer.