angular-google-maps icon indicating copy to clipboard operation
angular-google-maps copied to clipboard

Use .json data for Api Key

Open Kresys opened this issue 9 years ago • 3 comments

Hi,

I would like to use a .json file to get api key, but I get this error

ERROR in Error encountered resolving symbol values statically.

Here is my code in app.module.ts : import * as googleConfig from './shared/googleConfig/googleApi.json'; AgmCoreModule.forRoot({ apiKey : (<any>googleConfig).key, libraries: ["places","drawing"] }), And my .json: { "key": "MyKey" }

I already use .json data like this in other files, but it doesn't work like this. Any explanation ? :)

Thanks

Kresys avatar Jun 01 '17 08:06 Kresys

Could you show your googleApi.json file ?

gnujeremie avatar Jun 05 '17 07:06 gnujeremie

You should just be able to do AgmCoreModule.forRoot(require('./shared/googleConfig/googleApi.json'))

maneesht avatar Jun 07 '17 16:06 maneesht

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 13 '18 23:11 stale[bot]