Fix et add translation
This commit is contained in:
@@ -5,7 +5,7 @@ import {
|
||||
ReactiveFormsModule,
|
||||
Validators,
|
||||
} from "@angular/forms";
|
||||
import { TranslateModule } from "@ngx-translate/core";
|
||||
import { TranslateModule, TranslateService } from "@ngx-translate/core";
|
||||
import { MatFormFieldModule } from "@angular/material/form-field";
|
||||
import { MatInputModule } from "@angular/material/input";
|
||||
import { MatButtonModule } from "@angular/material/button";
|
||||
@@ -36,17 +36,26 @@ export class NewAircraftComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private serviceComm: ServiceComm,
|
||||
private serviceApi: AircraftService
|
||||
private serviceApi: AircraftService,
|
||||
private translateService: TranslateService,
|
||||
) {
|
||||
this.addForm = new FormGroup(
|
||||
{
|
||||
aircraftName: new FormControl("", Validators.required),
|
||||
},
|
||||
{ updateOn: "blur" }
|
||||
{ updateOn: "blur" },
|
||||
);
|
||||
}
|
||||
|
||||
ngOnInit() {}
|
||||
ngOnInit() {
|
||||
this.serviceComm.forceTranslateTitle.subscribe((data) => {
|
||||
if (data === true) {
|
||||
this.updateTitle();
|
||||
}
|
||||
});
|
||||
|
||||
this.updateTitle();
|
||||
}
|
||||
|
||||
onSubmit(formData) {
|
||||
if (formData.invalid) {
|
||||
@@ -98,4 +107,10 @@ export class NewAircraftComponent implements OnInit {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private updateTitle() {
|
||||
this.translateService.get("NewAircraft_Title").subscribe((data) => {
|
||||
this.serviceComm.updatedComponentTitle(data);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user