New view of list
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
<a routerLink="/summary" routerLinkActive="active">Summary</a>
|
||||
<a routerLink="/jumpsList" routerLinkActive="active">List of jumps</a>
|
||||
<a routerLink="/dz" routerLinkActive="active">List of DZs</a>
|
||||
<a routerLink="/newjump" routerLinkActive="active">Add a new jumps</a>
|
||||
<a routerLink="/aircraftList" routerLinkActive="active">List of aircrafts</a>
|
||||
<a routerLink="/jumpTypeList" routerLinkActive="active">List of jump types</a>
|
||||
<a routerLink="/newjump" routerLinkActive="active">Add a new jump</a>
|
||||
</nav>
|
||||
<router-outlet></router-outlet>
|
||||
<router-outlet></router-outlet>
|
||||
|
||||
@@ -10,13 +10,17 @@ import { NewJumpComponent } from './new-jump/new-jump.component';
|
||||
|
||||
import { ServiceApi } from '../services/serviceApi';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { ListOfAircraftsComponent } from './list-of-aircrafts/list-of-aircrafts.component';
|
||||
import { ListOfJumpTypesComponent } from './list-of-jump-types/list-of-jump-types.component';
|
||||
|
||||
|
||||
const appRoutes: Routes = [
|
||||
{ path: 'summary', component: SummaryComponent },
|
||||
{ path: 'jumpsList', component: ListOfJumpsComponent },
|
||||
{ path: 'dz', component: ListOfDzsComponent },
|
||||
{ path: 'newjump', component: NewJumpComponent }
|
||||
{ path: 'newjump', component: NewJumpComponent },
|
||||
{ path: 'aircraftList', component: ListOfAircraftsComponent },
|
||||
{ path: 'jumpTypeList', component: ListOfJumpTypesComponent }
|
||||
];
|
||||
|
||||
|
||||
@@ -26,7 +30,9 @@ const appRoutes: Routes = [
|
||||
SummaryComponent,
|
||||
ListOfJumpsComponent,
|
||||
ListOfDzsComponent,
|
||||
NewJumpComponent
|
||||
NewJumpComponent,
|
||||
ListOfAircraftsComponent,
|
||||
ListOfJumpTypesComponent
|
||||
],
|
||||
imports: [
|
||||
RouterModule.forRoot(
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<p>
|
||||
list-of-jump-types works!
|
||||
</p>
|
||||
|
||||
<table>
|
||||
<tr *ngFor="let jumpType of this.listOfJumpTypes; index as i;">
|
||||
<td>{{ jumpType.id }}</td>
|
||||
<td>{{ jumpType.name }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ListOfJumpTypesComponent } from './list-of-jump-types.component';
|
||||
|
||||
describe('ListOfJumpTypesComponent', () => {
|
||||
let component: ListOfJumpTypesComponent;
|
||||
let fixture: ComponentFixture<ListOfJumpTypesComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ListOfJumpTypesComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ListOfJumpTypesComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,24 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { JumpTypeResp } from '../../models/jumpType';
|
||||
import { ServiceApi } from '../../services/serviceApi';
|
||||
|
||||
@Component({
|
||||
selector: 'app-list-of-jump-types',
|
||||
templateUrl: './list-of-jump-types.component.html',
|
||||
styleUrls: ['./list-of-jump-types.component.css']
|
||||
})
|
||||
export class ListOfJumpTypesComponent implements OnInit {
|
||||
public listOfJumpTypes: Array<JumpTypeResp> = new Array<JumpTypeResp>();
|
||||
|
||||
constructor(private serviceApi: ServiceApi) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.getListOfJumpTypes();
|
||||
}
|
||||
|
||||
getListOfJumpTypes() {
|
||||
this.serviceApi.getListOfJumpTypes()
|
||||
.subscribe(data => this.listOfJumpTypes = data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user