Changeset fa375fe for trip-planner-front/src/app
- Timestamp:
- 10/16/21 18:10:51 (3 years ago)
- Branches:
- master
- Children:
- eed0bf8
- Parents:
- 6a3a178
- 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 7 7 providedIn:'root' 8 8 }) 9 10 9 export class CityService{ 11 10 constructor(private httpClient: HttpClient){ -
trip-planner-front/src/app/app.component.html
r6a3a178 rfa375fe 1 1 2 <app- planner>3 </app- planner>2 <app-locations-form> 3 </app-locations-form> -
trip-planner-front/src/app/app.module.ts
r6a3a178 rfa375fe 2 2 import { AppComponent } from './app.component'; 3 3 import { BrowserModule } from '@angular/platform-browser'; 4 import { NgModule } from '@angular/core';5 import {FormsModule } from '@angular/forms';4 import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; 5 import {FormsModule, ReactiveFormsModule} from '@angular/forms'; 6 6 import {HttpClient, HttpClientModule} from '@angular/common/http'; 7 7 import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; … … 22 22 import { MatButtonModule } from '@angular/material/button'; 23 23 import {MatGridListModule} from '@angular/material/grid-list'; 24 import { CreateInitialPlannerComponent } from './create-initial-planner/create-initial-planner.component'; 25 import { LocationsFormComponent } from './locations-form/locations-form.component'; 26 import { MatFormFieldModule } from '@angular/material/form-field'; 27 import {MatAutocompleteModule} from '@angular/material/autocomplete'; 24 28 25 29 @NgModule({ … … 27 31 AppComponent, 28 32 PlannerComponent, 29 LocationComponent 33 LocationComponent, 34 CreateInitialPlannerComponent, 35 LocationsFormComponent 30 36 ], 31 37 imports: [ … … 44 50 MatCardModule, 45 51 MatButtonModule, 46 MatGridListModule 52 MatGridListModule, 53 MatFormFieldModule, 54 MatAutocompleteModule, 55 HttpClientModule, 56 ReactiveFormsModule, 57 MatSelectModule 58 47 59 ], 48 60 providers: [ 49 61 CategoryService, 50 62 PlannerService 63 51 64 ], 52 bootstrap: [AppComponent] 65 bootstrap: [AppComponent], 66 schemas: [NO_ERRORS_SCHEMA] 53 67 54 68 }) -
trip-planner-front/src/app/location/location.component.html
r6a3a178 rfa375fe 5 5 <hr> 6 6 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>15 7 <div *ngFor="let companion of companions"> 16 8 {{companion.type}} -
trip-planner-front/src/app/location/location.component.ts
r6a3a178 rfa375fe 17 17 18 18 categories: Category[]; 19 cities: City[];20 countries:Country[];21 19 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) { 24 21 this.categories = []; 25 this.cities=[];26 this.countries = [];27 22 this.companions = []; 28 23 } … … 35 30 } 36 31 ); 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 );48 32 49 33 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 1 4 <mat-grid-list cols="4" rowHeight="250px"> 2 5 <mat-grid-tile *ngFor="let planner of planners" > -
trip-planner-front/src/app/planner/planner.component.ts
r6a3a178 rfa375fe 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 import { CreateInitialPlannerComponent } from '../create-initial-planner/create-initial-planner.component'; 6 4 7 5 8 @Component({ … … 11 14 12 15 planners: Planner[]; 13 constructor(private plannerService: PlannerService ) {16 constructor(private plannerService: PlannerService, public dialog: MatDialog) { 14 17 this.planners = []; 18 }; 19 20 openDialog(): void { 21 const dialogRef = this.dialog.open(CreateInitialPlannerComponent, { 22 width: '250px', 23 data: {} 24 }); 15 25 } 16 26 17 27 ngOnInit(): void { 18 28 this.plannerService.getAllPlanners().subscribe( … … 22 32 ); 23 33 } 24 34 25 35 }
Note:
See TracChangeset
for help on using the changeset viewer.