Why am I getting this error "Object literal may only specify known properties, and 'target'...

Discussão em 'Angular' iniciado por José Manuel Ruíz Bolaños, Novembro 5, 2024.

  1. I just got my code from another computer and this error shows up, I have been searching for some info but I dont know how to fix it, what Im trying to do here is to add a search bar in my google maps page

    async onSearch(event: any) {
    const query = event.target.value;

    if (query) {
    const geocodeUrl = ``;

    try {
    const response = await fetch(geocodeUrl);
    const data = await response.json();

    if (data.status === 'OK') {
    const location = data.results[0].geometry.location;
    this.map.setCamera({
    target: {
    lat: location.lat,
    lng: location.lng,
    },
    zoom: 15,
    });
    } else {
    console.error('No results found for the specified address.');
    }
    } catch (error) {
    console.error('Error fetching geocode:', error);
    }
    }
    }

    }


    I am using angular version 18.0.0 and ionic 8

    Continue reading...

Compartilhe esta Página