Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't display the map on the component #94

Closed
Mry3ll0w opened this issue Dec 21, 2022 · 3 comments
Closed

Can't display the map on the component #94

Mry3ll0w opened this issue Dec 21, 2022 · 3 comments

Comments

@Mry3ll0w
Copy link

Hi, I'm trying to use your package but after configuring the component module and adding the api key etc it just don't get displayed on the screen, the server opens but it just isn't shown, for further information I'm attaching my code just in case you need it.

The component that its using the code is Location:

location.module.ts

import { NgModule, CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core';
import { CommonModule } from '@angular/common';
import { GOOGLE_MAPS_API_CONFIG } from '@ng-maps/google';



@NgModule({
  declarations: [],
  imports: [
    CommonModule
  ],
  schemas: [ CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA],
  providers: [
    {
    provide: GOOGLE_MAPS_API_CONFIG,
    useValue: {
      apiKey: '[ HERE GOES MY API KEY]'
    }
}
  ]
})
export class LocationModule { }


location.component.html

<div class="container d-flex">
    
    <map-view [latitude]="48.858222" [longitude]="2.2945" [zoom]="8"></map-view>
</div>

Thanks in advice.

@DaSchTour
Copy link
Contributor

I think you are missing the import of NgMapsCoreModule and NgMapsGoogleModule.
And you shouldn't use schemas: [ CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA], as this hides errors of not imported modules.

@Mry3ll0w
Copy link
Author

I have imported those libraries inside the location module but the component is still not showing anything to me, please can you give me an example of how to create a simple demo about ng maps, and please remain the issue open, I couldn't make it work properly.

@DaSchTour
Copy link
Contributor

You can see a sample here: https://github.com/ng-maps/ng-maps/tree/main/apps/sample/src

Maybe it is because you have no hight set to the map. It's a google maps thing that the container must have a height.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants