File tree Expand file tree Collapse file tree 4 files changed +17
-2
lines changed
projects/train-platform/src Expand file tree Collapse file tree 4 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 13
13
}
14
14
},
15
15
"booking" : {
16
+ "title" : " Reise {{ id }} buchen" ,
16
17
"reserveSeatQuestion" : " Möchten Sie einen Sitzplatz reservieren?" ,
17
18
"firstClassQuestion" : " Möchten Sie in der ersten Klasse sitzen?" ,
18
19
"bookAction" : " Buchen" ,
Original file line number Diff line number Diff line change 13
13
}
14
14
},
15
15
"booking" : {
16
+ "title" : " Book journey {{ id }}" ,
16
17
"reserveSeatQuestion" : " Do you want to reserve a seat?" ,
17
18
"firstClassQuestion" : " Do you want to sit in first class?" ,
18
19
"bookAction" : " Book" ,
Original file line number Diff line number Diff line change
1
+ < h2 *ngIf ="journeyId$ | async as journeyId ">
2
+ {{ "booking.title" | translate: { id: journeyId } }}
3
+ </ h2 >
1
4
< div class ="booking-options ">
2
5
< div >
3
6
< label > {{ "booking.reserveSeatQuestion" | translate }}</ label >
Original file line number Diff line number Diff line change 1
- import { Component } from '@angular/core' ;
1
+ import { Component , OnInit } from '@angular/core' ;
2
2
import { ActivatedRoute } from '@angular/router' ;
3
3
import { HotToastService } from '@ngneat/hot-toast' ;
4
4
import { TranslateService } from '@ngx-translate/core' ;
5
+ import { Observable } from 'rxjs' ;
6
+ import { filter , map } from 'rxjs/operators' ;
5
7
import { BookingService } from '../booking.service' ;
6
8
7
9
@Component ( {
8
10
selector : 'app-booking' ,
9
11
templateUrl : './booking.component.html' ,
10
12
styleUrls : [ './booking.component.css' ] ,
11
13
} )
12
- export class BookingComponent {
14
+ export class BookingComponent implements OnInit {
13
15
reserveSeat = false ;
14
16
firstClass = false ;
17
+ journeyId$ ! : Observable < string > ;
15
18
16
19
constructor (
17
20
private bookingService : BookingService ,
@@ -20,6 +23,13 @@ export class BookingComponent {
20
23
private translateService : TranslateService
21
24
) { }
22
25
26
+ ngOnInit ( ) : void {
27
+ this . journeyId$ = this . route . params . pipe (
28
+ map ( ( params ) => params . journeyId ) ,
29
+ filter ( ( journeyId ) => journeyId )
30
+ ) ;
31
+ }
32
+
23
33
book ( ) : void {
24
34
this . bookingService
25
35
. book ( this . route . snapshot . params . journeyId , {
You can’t perform that action at this time.
0 commit comments