Я создаю приложение для бронирования авиабилетов.
В той части, где клиент выбирает место, я хочу поставить 6 кнопок в ряд. Я использую Список, чтобы показать все мои кнопки. Как и на картинке, первые 6 кнопок имеют правильное положение (красные кнопки). Но синие кнопки должны быть в следующем ряду (как я показываю на картинке). Как мне этого добиться?
myplaces-list.component.html
<div class="inventory-body" >
<h3 align="center">Wybierz miejsce</h3>
<div *ngFor="let myplace of myplaces | async" style="width: 300px;">
<myplace-details [myplace]='myplace'></myplace-details>
</div>
</div>
myplaces-list.component.ts
export class MyplacesListComponent implements OnInit {
myplaces: Observable<Myplace[]>;
place_id: number;
flight: Flight = new Flight();
submitted = false;
flight_id: number;
places: Observable<Place[]>;
constructor(private myplaceService: MyplaceService, private placeService: PlaceService, private flightService: FlightService,
private router: Router, private route: ActivatedRoute) { }
ngOnInit() {
this.route.params.subscribe(params => { this.flight_id = params['flight_id']; });
this.flightService.getFlight(this.flight_id).subscribe(t => this.flight = t);
this.reloadData();
}
reloadData() {
this.myplaces = this.myplaceService.fetchEmpDeptDataInnerJoin(this.flight_id);
this.places = this.placeService.getPlacesList();
}}
myplace-details.component.html - мои кнопки здесь
<div *ngIf="myplace" style="position: relative; left:-30%; margin-left:10px; margin-bottom:12px">
<div>
<a href="http://localhost:4200/ticket/{{myplace.flight_id}}/{{myplace.place_id}}"
*ngIf='myplace.active' (click)='updateActive(false)' class="button btn-primary">{{myplace.location}}</a></div>
<span class="button btn-danger" *ngIf='!myplace.active' >{{myplace.location}} </span>
MyPlace-details.component.ts
export class MyplaceDetailsComponent implements OnInit {
@Input() myplace: Myplace;
place_id: number;
constructor(private myplaceService: MyplaceService, private listComponent: MyplacesListComponent) { }
ngOnInit() {
this.place_id = this.myplace.place_id;
}
updateActive(isActive: boolean) {
this.myplaceService.updatePlace(this.place_id,
{ location: this.myplace.location, active: isActive })
.subscribe(
data => {
console.log(data);
this.myplace = data as Myplace;
},
error => console.log(error));
}}