Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with Angular2/Typescript? #9

Closed
marcbruederlin opened this issue May 17, 2016 · 7 comments
Closed

Not working with Angular2/Typescript? #9

marcbruederlin opened this issue May 17, 2016 · 7 comments

Comments

@marcbruederlin
Copy link

I'm trying to use this plugin in an angular 2 typescript project.

I added the plugin via the tns plugin add command and imported it with var mapbox = require('nativescript-mapbox'); in my component.ts file.
In the angular 2 ngOnInit event i call mapbox.show({ accessToken: '...' }); but i'm getting the following error:
Uncaught (in promise): TypeError: Cannot read property 'mapboxsdk' of undefined

Any idea how to solve this?

@skdeepak88
Copy link

Are u referencing mapboxsdk anywhere ?

@bloigge
Copy link

bloigge commented Jul 7, 2016

I do have the same in plain javascript as well

@EddyVerbruggen
Copy link
Collaborator

iOS or Android, and are you doing this before application.start(); perhaps?

@burkeholland
Copy link

I'm doing it in the constructor without issues. Might want to try moving it there, although I tried with ngInit and it worked fine there as well.

@smartcris
Copy link

I'm having the same issue on Android only with plain javascript:
JS: Error in mapbox.show: TypeError: Cannot read property 'mapboxsdk' of undefined

@l3lackcurtains
Copy link

  • uninstall the application from device

  • remove and add the plugin again

  • build the application

  • Run it.

    It worked for me, and it works for most of the plugin with such issues.

@marcbruederlin
Copy link
Author

Got it. I think the problem was that I forgot to add

<service android:name="com.mapbox.mapboxsdk.telemetry.TelemetryService" />

to my AndroidManifest.xml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants