bluehalo / ngx-leaflet-tutorial-plugins

MIT License
22 stars 10 forks source link

I get this error when I reference L.control.browserPrint. #10

Closed Treasureworth closed 6 years ago

Treasureworth commented 6 years ago

I get the error below when I reference L.control.browserPrint. Meanwhile i editted the index.ts.d of leaflet to expose leaflet-browser-print plugin. I used Angular 6

ERROR TypeError: leafletWEBPACK_IMPORTED_MODULE_3__.control.browserPrint is not a function at TitleDeedComponent.push../src/app/title-deed/title-deed.component.ts.TitleDeedComponent.onMapReady (title-deed.component.ts:190) at Object.eval [as handleEvent] (VM4552 TitleDeedComponent.ngfactory.js:17) at handleEvent (core.js:11107) at callWithDebugContext (core.js:12204) at Object.debugHandleEvent [as handleEvent] (core.js:11907) at dispatchEvent (core.js:8561) at core.js:10044 at SafeSubscriber.schedulerFn [as _next] (core.js:3724) at SafeSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.tryOrUnsub (Subscriber.js:195) at SafeSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.next (Subscriber.js:133)

reblace commented 6 years ago

I updated the browser print example to use ng6. Can you check it out and see if it helps fix your issue? If you reference leaflet elsewhere, you might need to make sure you're importing both Leaflet and BrowserPrint in the file in which you're using it.

Treasureworth commented 6 years ago

Thanks @reblace . The error still shows up. I don't seem to understand what I'm not doing right. I created the typings.d.ts like you added.

Treasureworth commented 6 years ago

I later just downloaded your project and build around it and it is now working. I really don't know what was going wrong with my own original project.

Thanks

reblace commented 6 years ago

I'm going to close this issue since it sounds like the issue has been resolved. Thanks!