File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed
app/components/cost/detail Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ ActionBar {
1212}
1313
1414.favorite-label {
15+ padding : 15 ;
16+ font-size : 17pt ;
1517 text-align : center;
1618 vertical-align : middle;
1719}
Original file line number Diff line number Diff line change 3030
3131 < Label class ="favorite-label "
3232 [text] ="cost.isFavorite === true ? 'Favorite' : 'Not Favorite' "
33- (tap) ="onTap () "> </ Label >
33+ (tap) ="onFavoriteTap () "> </ Label >
3434
3535</ StackLayout >
Original file line number Diff line number Diff line change @@ -24,7 +24,6 @@ export class CostDetailComponent implements OnInit {
2424 ngOnInit ( ) : void {
2525 const id = this . route . snapshot . params [ "id" ] ;
2626 this . cost = this . costService . getCost ( id ) ;
27- console . log ( JSON . stringify ( this . cost ) ) ;
2827 }
2928
3029 onEditButtonTap ( ) : void {
@@ -44,8 +43,12 @@ export class CostDetailComponent implements OnInit {
4443 this . routerExtensions . back ( ) ;
4544 }
4645
47- onTap ( ) {
48- this . cost . isFavorite = ! this . cost . isFavorite ;
46+ onFavoriteTap ( ) {
47+ let costForUpdate = Object . assign ( { } , this . cost ) ;
48+ costForUpdate . isFavorite = ! this . cost . isFavorite ;
49+ this . costService . updateCost ( costForUpdate ) . then ( result => {
50+ this . cost . isFavorite = ! this . cost . isFavorite ;
51+ } ) ;
4952 }
5053
5154 private formatChangesDate ( changesDate : string ) {
You can’t perform that action at this time.
0 commit comments