Use .json data for Api Key
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
Could you show your googleApi.json file ?
You should just be able to do AgmCoreModule.forRoot(require('./shared/googleConfig/googleApi.json'))
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.