Property '...' has no initializer and is not definitely assigned in the constructor

Discussão em 'Angular' iniciado por Mikhail Kostiuchenko, Março 17, 2025.

  1. in my Angular app i have a component:

    import { MakeService } from './../../services/make.service';
    import { Component, OnInit } from '@angular/core';

    @Component({
    selector: 'app-vehicle-form',
    templateUrl: './vehicle-form.component.html',
    styleUrls: ['./vehicle-form.component.css']
    })
    export class VehicleFormComponent implements OnInit {
    makes: any[];
    vehicle = {};

    constructor(private makeService: MakeService) { }

    ngOnInit() {
    this.makeService.getMakes().subscribe(makes => { this.makes = makes
    console.log("MAKES", this.makes);
    });
    }

    onMakeChange(){
    console.log("VEHICLE", this.vehicle);
    }
    }


    but in the "makes" property I have a mistake. I dont know what to do with it...

    [​IMG]

    Continue reading...

Compartilhe esta Página