Ignore:
Timestamp:
11/04/21 23:10:39 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
ceaed42
Parents:
6a80231
Message:

edit planner form with angular

Location:
trip-planner-front/src/app/location
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trip-planner-front/src/app/location/location.component.html

    r6a80231 r6c1585f  
    1 <div *ngFor="let category of categories">
    2   {{category.name}}
    3   </div>
     1<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
    42
    5   <hr>
     3<h3>Here are all locations</h3>
    64
    7   <div *ngFor="let companion of companions">
    8     {{companion.type}}
    9   </div>
     5<div class="container">
     6  <table mat-table  class="mat-elevation-z8">
     7
     8    <!--- Note that these columns can be defined in any order.
     9          The actual rendered columns are set as a property on the row definition" -->
     10 
     11    <!-- Position Column -->
     12    <ng-container matColumnDef="position">
     13      <th mat-header-cell *matHeaderCellDef> Location name </th>
     14      <td mat-cell *matCellDef="let element">  </td>
     15    </ng-container>
     16 
     17 
     18    <!-- Symbol Column -->
     19    <ng-container matColumnDef="symbol">
     20      <th mat-header-cell *matHeaderCellDef> Symbol </th>
     21      <td mat-cell *matCellDef="let element">  </td>
     22    </ng-container>
     23 
     24    <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
     25    <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
     26  </table>
     27</div>
  • trip-planner-front/src/app/location/location.component.ts

    r6a80231 r6c1585f  
    1616export class LocationComponent implements OnInit {
    1717
    18   categories: Category[];
    19   companions: Companion[];
    20   constructor(private categoryService: CategoryService, private companionService : CompanionService) {
    21     this.categories = [];
    22     this.companions = [];
     18  constructor() {
     19   
    2320   }
    2421   
    2522  ngOnInit(): void {
    26     this.categoryService.getAllCategories().subscribe(
    27       data => {
    28         this.categories = data;
    29         console.log(data);
    30       }
    31     );
    32 
    33     this.companionService.getAllCompanions().subscribe(
    34       data => {
    35         this.companions = data;
    36       }
    37     );
     23   
    3824  }
    3925}
Note: See TracChangeset for help on using the changeset viewer.