Ignore:
Timestamp:
10/16/21 18:10:51 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
eed0bf8
Parents:
6a3a178
Message:

adding new components

Location:
trip-planner-front/src/app
Files:
7 added
7 edited

Legend:

Unmodified
Added
Removed
  • trip-planner-front/src/app/_services/city.service.ts

    r6a3a178 rfa375fe  
    77    providedIn:'root'
    88})
    9 
    109export class CityService{
    1110    constructor(private httpClient: HttpClient){
  • trip-planner-front/src/app/app.component.html

    r6a3a178 rfa375fe  
    11
    2   <app-planner>
    3   </app-planner>
     2  <app-locations-form>
     3  </app-locations-form>
  • trip-planner-front/src/app/app.module.ts

    r6a3a178 rfa375fe  
    22import { AppComponent } from './app.component';
    33import { BrowserModule } from '@angular/platform-browser';
    4 import { NgModule } from '@angular/core';
    5 import {FormsModule} from '@angular/forms';
     4import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
     5import {FormsModule, ReactiveFormsModule} from '@angular/forms';
    66import {HttpClient, HttpClientModule} from '@angular/common/http';
    77import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
     
    2222import { MatButtonModule } from '@angular/material/button';
    2323import {MatGridListModule} from '@angular/material/grid-list';
     24import { CreateInitialPlannerComponent } from './create-initial-planner/create-initial-planner.component';
     25import { LocationsFormComponent } from './locations-form/locations-form.component';
     26import { MatFormFieldModule } from '@angular/material/form-field';
     27import {MatAutocompleteModule} from '@angular/material/autocomplete';
    2428
    2529@NgModule({
     
    2731    AppComponent,
    2832    PlannerComponent,
    29     LocationComponent
     33    LocationComponent,
     34    CreateInitialPlannerComponent,
     35    LocationsFormComponent
    3036  ],
    3137  imports: [
     
    4450    MatCardModule,
    4551    MatButtonModule,
    46     MatGridListModule
     52    MatGridListModule,
     53    MatFormFieldModule,
     54    MatAutocompleteModule,
     55    HttpClientModule,
     56    ReactiveFormsModule,
     57    MatSelectModule
     58   
    4759  ],
    4860  providers: [
    4961    CategoryService,
    5062    PlannerService
     63   
    5164  ],
    52   bootstrap: [AppComponent]
     65  bootstrap: [AppComponent],
     66  schemas: [NO_ERRORS_SCHEMA]
    5367 
    5468})
  • trip-planner-front/src/app/location/location.component.html

    r6a3a178 rfa375fe  
    55  <hr>
    66
    7   <div *ngFor="let city of cities">
    8     {{city.name}}
    9   </div>
    10   <div *ngFor="let country of countries">
    11     {{country.name}}
    12   </div>
    13 
    14   <hr>
    157  <div *ngFor="let companion of companions">
    168    {{companion.type}}
  • trip-planner-front/src/app/location/location.component.ts

    r6a3a178 rfa375fe  
    1717
    1818  categories: Category[];
    19   cities: City[];
    20   countries:Country[];
    2119  companions: Companion[];
    22   constructor(private categoryService: CategoryService, private cityService : CityService,
    23             private countryService : CountryService, private companionService : CompanionService) {
     20  constructor(private categoryService: CategoryService, private companionService : CompanionService) {
    2421    this.categories = [];
    25     this.cities=[];
    26     this.countries = [];
    2722    this.companions = [];
    2823   }
     
    3530      }
    3631    );
    37     this.cityService.getAllCities().subscribe(
    38       data => {
    39         this.cities = data;
    40 
    41       }
    42     );
    43     this.countryService.getAllCountries().subscribe(
    44       data => {
    45         this.countries = data;
    46       }
    47     );
    4832
    4933    this.companionService.getAllCompanions().subscribe(
  • trip-planner-front/src/app/planner/planner.component.html

    r6a3a178 rfa375fe  
     1
     2<button mat-raised-button (click)="openDialog()">Create initial planner</button>
     3
    14<mat-grid-list cols="4" rowHeight="250px">
    25  <mat-grid-tile *ngFor="let planner of planners" >
  • trip-planner-front/src/app/planner/planner.component.ts

    r6a3a178 rfa375fe  
    22import { Planner } from '../_models/planner';
    33import { PlannerService } from '../_services/planner.service';
     4import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
     5import { CreateInitialPlannerComponent } from '../create-initial-planner/create-initial-planner.component';
     6
    47
    58@Component({
     
    1114
    1215  planners: Planner[];
    13   constructor(private plannerService: PlannerService) {
     16  constructor(private plannerService: PlannerService, public dialog: MatDialog) {
    1417    this.planners = [];
     18  };
     19 
     20  openDialog(): void {
     21    const dialogRef = this.dialog.open(CreateInitialPlannerComponent, {
     22      width: '250px',
     23      data: {}
     24    });
    1525  }
    16 
     26 
    1727  ngOnInit(): void {
    1828    this.plannerService.getAllPlanners().subscribe(
     
    2232    );
    2333  }
    24 
     34 
    2535}
Note: See TracChangeset for help on using the changeset viewer.