Skip to content

Commit 1d9abba

Browse files
committed
chore(demo): use signal view queries
1 parent 0778324 commit 1d9abba

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

apps/demo/src/app/flight-search-data-service-dynamic/flight-edit.component.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnInit, ViewChild, inject, input } from '@angular/core';
1+
import { Component, OnInit, inject, input, viewChild } from '@angular/core';
22
import { FormsModule, NgForm } from '@angular/forms';
33
import { RouterModule } from '@angular/router';
44
import { Flight } from '../shared/flight';
@@ -10,8 +10,7 @@ import { FlightBookingStore } from './flight-booking.store';
1010
templateUrl: './flight-edit.component.html',
1111
})
1212
export class FlightEditDynamicComponent implements OnInit {
13-
@ViewChild(NgForm)
14-
private form!: NgForm;
13+
private readonly form = viewChild.required(NgForm);
1514

1615
private store = inject(FlightBookingStore);
1716

@@ -26,7 +25,7 @@ export class FlightEditDynamicComponent implements OnInit {
2625
}
2726

2827
async save() {
29-
const flight = this.form.value as Flight;
28+
const flight = this.form().value as Flight;
3029
if (flight.id) {
3130
await this.store.updateFlight(flight);
3231
} else {
@@ -39,6 +38,6 @@ export class FlightEditDynamicComponent implements OnInit {
3938
}
4039

4140
async deleteFlight() {
42-
await this.store.deleteFlight(this.form.value);
41+
await this.store.deleteFlight(this.form().value);
4342
}
4443
}

0 commit comments

Comments
 (0)