You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: MyApp/_pages/releases/v8_07.md
+24Lines changed: 24 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -668,6 +668,30 @@ E.g. the `<form-loading>` component will display when API Requests are in-flight
668
668
</app-page>
669
669
```
670
670
671
+
### Create Booking
672
+
673
+
The [booking-create.component.ts](https://github.com/NetCoreTemplates/angular-spa/blob/main/MyApp.Client/src/app/bookings/booking-create.component.ts) shows the standard pattern of calling ServiceStack Typed APIs to
674
+
save forms whilst saving any validation errors to the `ApiState` context:
675
+
676
+
```ts
677
+
asyncsave(): Promise<void> {
678
+
this.api.begin();
679
+
680
+
const request=newCreateBooking(this.booking());
681
+
const api=awaitthis.client.api(request);
682
+
if (api.succeeded) {
683
+
// Navigate back to bookings list after successful save
684
+
this.router.navigate(['/bookings']);
685
+
}
686
+
687
+
this.api.complete(api.error);
688
+
}
689
+
```
690
+
691
+
Where any contextual validation will be displayed next to the input field:
The [booking-edit.component.ts](https://github.com/NetCoreTemplates/angular-spa/blob/main/MyApp.Client/src/app/bookings/booking-edit.component.ts)
Copy file name to clipboardExpand all lines: MyApp/_pages/templates/angular.md
+24Lines changed: 24 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -277,6 +277,30 @@ after receiving failed API Responses:
277
277
</app-page>
278
278
```
279
279
280
+
### Create Booking
281
+
282
+
The [booking-create.component.ts](https://github.com/NetCoreTemplates/angular-spa/blob/main/MyApp.Client/src/app/bookings/booking-create.component.ts) shows the standard pattern of calling ServiceStack Typed APIs to
283
+
save forms whilst saving any validation errors to the `ApiState` context:
284
+
285
+
```ts
286
+
asyncsave(): Promise<void> {
287
+
this.api.begin();
288
+
289
+
const request=newCreateBooking(this.booking());
290
+
const api=awaitthis.client.api(request);
291
+
if (api.succeeded) {
292
+
// Navigate back to bookings list after successful save
293
+
this.router.navigate(['/bookings']);
294
+
}
295
+
296
+
this.api.complete(api.error);
297
+
}
298
+
```
299
+
300
+
Where any contextual validation will be displayed next to the input field:
The [booking-edit.component.ts](https://github.com/NetCoreTemplates/angular-spa/blob/main/MyApp.Client/src/app/bookings/booking-edit.component.ts)
0 commit comments