-
Notifications
You must be signed in to change notification settings - Fork 48
How to import modules outside of loadModules()? #8
Comments
Answer I was confused about the
This is actually already documented here: https://github.com/TheKeithStewart/angular-esri-components/blob/68861b286fd3a4814c495c2bd723e336e917ced2/src/lib/esri4-map/esri4-map.component.ts#L20-L26 |
Another good documentation topic. We need to doc the |
Yes, I'm struggling with the namespace the most at present. Would you mind helping me with the following? I'm currently getting the error:
Note: this error appears in the browser console (from Full gist: https://gist.github.com/jplew/cf61707f727dfe8fb897f838ee444af4#file-map-component-ts-L387 In an attempt to resolve that, I tried aliasing the namespace (as per the original component). However that just shifts the location of the error:
Do you know why it is doing this? |
Did you try moving Each component that uses esri types has to have that reference. As long as the esri types have been installed and exist under the |
Update I managed to get everything working by importing my modules using The problem with this approach is that it does not enable code reuse. My desire is to define a helper method outside of I tried your suggestion, and restored |
Just adding a +1 from me. I'd like to use this library too but like jplew I'm struggling a bit understanding how to integrate the examples from the Esri website with this Angular based approach. In particular I've hit a roadblock around the use of JSX. Looking forward to any pointers you might be able to give. |
Haven't looked at them myself, but have you seen these React-specific repos? https://github.com/davetimmins/arcgis-react-redux-legend |
@perfectr yep, we are only planning on providing typescript/javascript samples for Angular 5 and 6. You are welcome to open Angular/JSX related issues and hopefully folks in the community can provide answers. |
Here are a few comments that will hopefully help to clarify some of the questions above:
|
Closing. We might be able to fix some of the namespace issues with the new TS |
I am trying to rewrite the Sample Code for "Create a FeatureLayer with client side graphics" in Typescript rather than plain JS. I got all my red squigglies to go away but am running into an issue at compile-time because of my imports.
I know I can load modules like this:
However, this scopes my
EsriLegend
variable to mythen
block. I want to reuse it in another method outside. For example I want to goconst legend = new EsriLegend()
in a helper function defined outside ofngOnInit
.To achieve this, I tried:
But the compiler complains:
I then tried this (like the docs curiously seem to recommend):
But got this error instead:
Here is my full attempt at a Typescript rewrite: https://gist.github.com/jplew/c0ebade552034ea1630ec05067bd18e4
Thanks very much.
The text was updated successfully, but these errors were encountered: