New view of list
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
<p>
|
||||
list-of-aircrafts works!
|
||||
</p>
|
||||
|
||||
<table>
|
||||
<tr *ngFor="let aircraft of this.listOfAircrafts; index as i;">
|
||||
<td>{{ aircraft.id }}</td>
|
||||
<td>{{ aircraft.name }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ListOfAircraftsComponent } from './list-of-aircrafts.component';
|
||||
|
||||
describe('ListOfAircraftsComponent', () => {
|
||||
let component: ListOfAircraftsComponent;
|
||||
let fixture: ComponentFixture<ListOfAircraftsComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ListOfAircraftsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ListOfAircraftsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,24 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { AircraftResp } from '../../models/aircraft';
|
||||
import { ServiceApi } from '../../services/serviceApi';
|
||||
|
||||
@Component({
|
||||
selector: 'app-list-of-aircrafts',
|
||||
templateUrl: './list-of-aircrafts.component.html',
|
||||
styleUrls: ['./list-of-aircrafts.component.css']
|
||||
})
|
||||
export class ListOfAircraftsComponent implements OnInit {
|
||||
public listOfAircrafts: Array<AircraftResp> = new Array<AircraftResp>();
|
||||
|
||||
constructor(private serviceApi: ServiceApi) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.getListOfAircrafts();
|
||||
}
|
||||
|
||||
getListOfAircrafts() {
|
||||
this.serviceApi.getListOfAircrafts()
|
||||
.subscribe(data => this.listOfAircrafts = data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user