Last change
on this file since 6a80231 was 6a80231, checked in by Ema <ema_spirova@…>, 3 years ago |
create initial planner and routing with angular
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[6a3a178] | 1 | import { Component, OnInit } from '@angular/core';
|
---|
| 2 | import { Planner } from '../_models/planner';
|
---|
| 3 | import { PlannerService } from '../_services/planner.service';
|
---|
[fa375fe] | 4 | import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
|
---|
| 5 | import { CreateInitialPlannerComponent } from '../create-initial-planner/create-initial-planner.component';
|
---|
[6a80231] | 6 | import { Router } from '@angular/router';
|
---|
[fa375fe] | 7 |
|
---|
[6a3a178] | 8 |
|
---|
| 9 | @Component({
|
---|
| 10 | selector: 'app-planner',
|
---|
| 11 | templateUrl: './planner.component.html',
|
---|
| 12 | styleUrls: ['./planner.component.css']
|
---|
| 13 | })
|
---|
| 14 | export class PlannerComponent implements OnInit {
|
---|
| 15 |
|
---|
| 16 | planners: Planner[];
|
---|
[6a80231] | 17 | plannerId: number;
|
---|
| 18 |
|
---|
| 19 | constructor(private plannerService: PlannerService, public dialog: MatDialog, private router: Router) {
|
---|
[6a3a178] | 20 | this.planners = [];
|
---|
[6a80231] | 21 | this.plannerId = 1;
|
---|
[fa375fe] | 22 | };
|
---|
| 23 |
|
---|
| 24 | openDialog(): void {
|
---|
| 25 | const dialogRef = this.dialog.open(CreateInitialPlannerComponent, {
|
---|
| 26 | width: '250px',
|
---|
| 27 | data: {}
|
---|
| 28 | });
|
---|
[6a3a178] | 29 | }
|
---|
[fa375fe] | 30 |
|
---|
[6a3a178] | 31 | ngOnInit(): void {
|
---|
| 32 | this.plannerService.getAllPlanners().subscribe(
|
---|
| 33 | data => {
|
---|
| 34 | this.planners = data;
|
---|
| 35 | }
|
---|
| 36 | );
|
---|
| 37 | }
|
---|
[fa375fe] | 38 |
|
---|
[6a80231] | 39 | onClickEditPlanner(id: number){
|
---|
| 40 | console.log(id);
|
---|
| 41 |
|
---|
| 42 |
|
---|
| 43 | this.router.navigate(['edit/planner/', this.plannerId])
|
---|
| 44 |
|
---|
| 45 | }
|
---|
[6a3a178] | 46 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.