Please help me,
my dependencies:
"@agm/core": "^1.0.0-beta.0"
my app.module:
import { AgmCoreModule } from '@agm/core';
AgmCoreModule.forRoot({
apiKey: '(myapikey)'
})
my template:
<ion-content padding>
<agm-map></agm-map>
</ion-content>
which is the error?
thanks, you are the best!!
You have nothing in your template ?
Yes, only agm-map element
<agm-map></agm-map>
Oh ok, didn't see it at first before your edited it.
Now I see the problem, you should get a look at the Plunker on the README of the project, you will understand straight away.
Basically you have to add this import :
import { Component} from '@angular/core';
Then add a component :
@Component({
selector: 'my-map',
styles: [`
.sebm-google-map-container {
height: 300px;
}
`],
template: `
<sebm-google-map>
</sebm-google-map>
`})
And finally replace your template by :
<ion-content padding>
<agm-map></agm-map>
</ion-content>
With that you should have a basic google map displayed.
Let me know how it goes !
@jespoz
Encountered same error, solution was to add AgmCoreModule to imports at the module that uses the map, so having AppModule and AccountModule I have following imports:
@NgModule({
imports: [
***,
AgmCoreModule.forRoot({
apiKey: 'AIzaSyAsMcr_0zqJ0QG18Z4cx-ETuOps02jhD3g'
})
],
declarations: [***],
bootstrap: [*** ]
})
export class AppModule {
}
@NgModule({
imports: [
***,
AgmCoreModule
],
declarations: [
***
],
providers: [
***
]
})
export class AccountModule {
}
Please note that * stands for other non-relative to the problem imports, providers etc
It is really a little ambiguous that we have to use AgmCore**Module at the nested modules
Thank you so much @Golem765 it worked!
@Golem765 It's not working.
Basically I want to use the map in module other than appModule. But I am getting error as 'ngui-map' is not a known element.
@pammusankolli
Double check the config, it is totally working for me in any combination of modules, even if module that uses map is shared between different angular apps.
Also note that you are getting another error than described in issue, so consider looking for another reasons
not working still the same error
Take a look at the guide on Angular modules in the docs for details. There is no bug and the question has been answered.
i had the same problem for snazzy info window, same fix though just add "AgmSnazzyInfoWindowModule," as a line in the imports in app.module.ts
Most helpful comment
@jespoz
Encountered same error, solution was to add AgmCoreModule to imports at the module that uses the map, so having AppModule and AccountModule I have following imports:
Please note that * stands for other non-relative to the problem imports, providers etc
It is really a little ambiguous that we have to use AgmCore**Module at the nested modules