bluehalo / ngx-leaflet-tutorial-plugins

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Treasureworth opened this issue · comments

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: leaflet__WEBPACK_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)

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.

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.

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

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