Skip to content

bug(GeoCoder): ERROR ReferenceError: google is not defined #22148

Closed
@ivayloc

Description

@ivayloc

Reproduction

The error is reproducible here https://stackblitz.com/edit/components-issue-8f7l3p?file=src%2Fapp%2Fexample-component.ts, just check the console.

DynamicFormQuestionComponent.html:72 ERROR ReferenceError: google is not defined
    at new MapGeocoder (google-maps.js:3032)
    at createClass (core.js:21148)
    at _createProviderInstance$1 (core.js:21133)
    at createProviderInstance (core.js:21010)
    at createViewNodes (core.js:29374)
    at createEmbeddedView (core.js:29295)
    at callWithDebugContext (core.js:30309)
    at Object.debugCreateEmbeddedView [as createEmbeddedView] (core.js:29833)
    at TemplateRef_.push../node_modules/@angular/core/fesm5/core.js.TemplateRef_.createEmbeddedView (core.js:20742)
    at ViewContainerRef_.push../node_modules/@angular/core/fesm5/core.js.ViewContainerRef_.createEmbeddedView (core.js:20608)

Steps to reproduce:

  1. Lazy Load the API
  2. Import the MapGeocoder provider
  3. Load the provider in a component
  4. Inject the provider in the constructor

Expected Behavior

Load the provider without the error

ERROR ReferenceError: google is not defined

Actual Behavior

An error is logged in the Chrome DevTools console.

Environment

  • Angular: 11.2.4
  • CDK/Material: 11.2.3
  • Browser(s): Chrome
  • Operating System: Windows 10:

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: google-maps

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions