Error "services is undefined" in "tt.services.reverseGeocode" function

When I try to perform the “taxi dispatcher” example, in the following code:
tt.services.reverseGeocode ({
key: this.apiKey,
position: position,
}). go ()
.then (function (results) {
console.log (results);
//this.drawPassengerMarkerOnMap(results);
});

the DOM generates the following error:

ERROR TypeError: _tomtom_international_web_sdk_maps__WEBPACK_IMPORTED_MODULE_1___default.a.services is undefined

I am doing it with angular

Did you attach the services library?

1 Like

Hi, yes .

import { tt as ttMaps} from ‘@tomtom-international/web-sdk-maps’;
import tt from ‘@tomtom-international/web-sdk-services’;

In the code I tried to import both, because the TT of “web-sdk-maps” does not work for me. I tried importing the web-sdk-services and it didn’t work either

Please import libraries this way:
import { default as ttServices } from ‘@tomtom-international/web-sdk-services’;
import { default as ttMaps } from ‘@tomtom-international/web-sdk-maps’;

We only export “default” from both libraries.

As we transpile our modules to commonJS, this should also work:
import { services } from ‘@tomtom-international/web-sdk-services’;
import { map, LngLat } from ‘@tomtom-international/web-sdk-maps’;

1 Like