์๋ ํ์ธ์ @SebastianM ,
ionic2 / angular2์์ angular2-google-maps๋ฅผ ์ฌ์ฉํ๊ณ ์๋๋ฐ, ํ ํ์ด์ง์๋ง์ง๋๊ฐ ํ์ํ๊ณ ์ ์๋ํ์ง๋ง ๊ฐ์ ํ์ด์ง๋ฅผ ์ฐ์์ ์ผ๋ก ๋ฐฉ๋ฌธ ํ ๋๋ง๋ค ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
You have included the Google Maps API multiple times on this page. This may cause unexpected errors.
๋ด๊ฐ ๋น ์ง ๊ฒ์ด ์์ผ๋ฉด ์๋ ค์ฃผ์ธ์.
๊ฐ์ฌ
๊ทธ๋ @ravindranpandu ,
ํ์ด์ง ์ด๋์์๋ Google์ง๋ ์คํฌ๋ฆฝํธ๋ฅผ ์ง์ ๋ก๋ํฉ๋๊น?
์๋์, ๊ทธ๋ฅ typescript ํ์ผ๋ก ๊ฐ์ ธ ์ค๋ฉด ํด๋น ํ์ด์ง๋ฅผ ๋ฐฉ๋ฌธ ํ ๋๋ง๋ค googlemap api์ ์ฐ๊ฒฐ๋๋ html์ ์คํฌ๋ฆฝํธ ํ๊ทธ๊ฐ ์ถ๊ฐ๋ฉ๋๋ค.
์์ ์ฒจ๋ถ ๋ ์ด๋ฏธ์ง์์ googlemap ์คํฌ๋ฆฝํธ ํ๊ทธ๊ฐ 7 ๋ฒ ์ถ๊ฐ ๋ ๊ฒ์ ๋ณผ ์ ์์ต๋๋ค. ์ฆ, ํ์ด์ง๋ฅผ 7 ๋ฒ ๋ฐฉ๋ฌธํ์์ ์๋ฏธํฉ๋๋ค.
@ravindranpandu ํ , bootstrap()
ํจ์๋ฅผ ๋ณด์ฌ์ค ์ ์์ต๋๊น?
์๋ ํ์ธ์ @SebastianM ,
์ํ ์ฑ์ ๋ ์ฝ๊ฒ ๋ง๋ค ์ ์๋๋ก ํด๋น ionic ์ฑ์์ ๋ฌธ์ ๋ฅผ ๋ณผ ์ ์์ต๋๋ค.
https://github.com/ravindranpandu/angular-map
๋ฏธ๋ฆฌ ๊ฐ์ฌ๋๋ฆฝ๋๋ค
์ง๋ ํ์ด์ง๋ฅผ ๋ ๋ฒ ์ด์ ๋ฐฉ๋ฌธํ๋ฉด ๋ด๊ฐ ๋งํ ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค.
You have included the Google Maps API multiple times on this page. This may cause unexpected errors.
์ ์ด๋ฐ ์ผ์ด ๋ฐ์ํ๋์ง ์ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค. ๋ฌด์์ด ์๋ชป๋์๋์ง ์๋ ค์ฃผ์ธ์.
๊ฐ์ฌ
@ravindranpandu ์ด ์ค์ด ์ด์ ์
๋๋ค.
https://github.com/ravindranpandu/angular-map/blob/master/app/pages/map/map.ts#L14
์ด ์ฅ์์ ANGULAR2_GOOGLE_MAPS_PROVIDERS๋ฅผ ํฌํจ ํ ๋์ง๋ ๋ก๋์ ์ฌ๋ฌ ์ธ์คํด์ค๋ฅผ ๋ง๋ญ๋๋ค.
bootstrap () ๋ฉ์๋์์ ANGULAR2_GOOGLE_MAPS_PROVIDERS๋ฅผ ์ฌ์ฉํด์ผํฉ๋๋ค.
@SebastianM ์ด์ ๋ฉ์ธ app.ts ๊ณต๊ธ์์์ ANGULAR2_GOOGLE_MAPS_PROVIDERS๋ฅผ ์ด๊ธฐํํ์ต๋๋ค. ์ด์ ์์๋๋ก ์๋ํฉ๋๋ค. ์๊ฐ ๋ด ์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค.
์ด๊ฒ์ ๋ฃจํธ ์ฑ ๋ชจ๋ ๋์ ๊ธฐ๋ฅ ๋ชจ๋์์ angular2-google-maps๋ฅผ ์ฌ์ฉํ ๋๋ ๋ฐ์ํ๋ ๊ฒ ๊ฐ์ต๋๋ค. ๋๊ตฌ๋ ์ง ํ์ธํ ์ ์์ต๋๊น?
app.module.ts ๊ฐ์ ธ ์ค๊ธฐ์์ ๋ค์์ ์ถ๊ฐํ์ญ์์ค.
AgmCoreModule.forRoot({
apiKey: 'xxxxxx',
libraries: ['places']
})
(๋ฌผ๋ก ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ ๊ฑฐ ํ ์ ์์ต๋๋ค : [ 'places'])
๊ทธ๋ฐ ๋ค์ ๊ณต์ ๋ชจ๋์ ๋ค์์ ์ถ๊ฐํ์ญ์์ค.
์์
ํ
AgmCoreModule
๋ฐ ์์ถ :
AgmCoreModule
๋ค์
You have included the Google Maps API multiple times on this page. This may cause unexpected errors.
์ฌ๋ผ์ง
์ฌ๋ฌ๋ถ, ์ด์ ์ฐ๋ฆฌ๊ฐ ์ง์ฐ ๋ก๋ฉ์ผ๋ก ์ด๋ป๊ฒ ์์
ํ๋์ง ์๋ ์ฌ๋ ์๋์?
GOOGLE_MAPS_PROVIDERS ๋ ๋ ์ด์ ์ฌ์ฉ๋์ง ์์ผ๋ฉฐ ๋์ ๋ชจ๋์ด๋ก๋ ๋ ๋ API ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ๋ก๋ ํ ๋๋ง๋ค๋ก๋๋๋ AgmCoreModule ์ ์ฌ์ฉํฉ๋๋ค.
@szykov ์ง์ฐ๋ก๋ ๋ ํ์ ๋ชจ๋์์์ด angular2 ๊ตฌ์ฑ ์์๋ฅผ ์ฌ์ฉํ๋ ํด๊ฒฐ์ฑ ์ @efstathiosntonas๊ฐ ๋งํ๋๋กํ๋ ๊ฒ์ ๋๋ค.
๋จผ์ ๊ธฐ๋ณธ app.module.ts
์ API๋ฅผ ํฌํจํ์ญ์์ค.
// app.module.ts
import { AgmCoreModule } from 'angular2-google-maps/core';
//other stuff here
@NgModule({
bootstrap: [AppComponent],
declarations: [ // declarations contains: components, directives and pipes],
imports: [ // import other modules here
AgmCoreModule.forRoot({
apiKey: 'YOUR_KEY'
})],
providers: [ // expose our Services and Providers into Angular's dependency injection]
})
๊ทธ๋ฐ ๋ค์ ํ์ ๋ชจ๋ ๋ด๋ถ์ API ํค์์ด ๋ค์ ํฌํจํ์ญ์์ค.
// maps.module.ts (submodule)
import { AgmCoreModule } from 'angular2-google-maps/core';
// other stuff
@NgModule({
imports: [ // other imports here
AgmCoreModule
],
declarations: [ // Components / Directives / Pipes
MapComponent
]
})
์ด์ angular2 ๋งต ๊ตฌ์ฑ ์์๋ฅผ ์ง์ฐ๋ก๋ํ๊ณ ์๋ฐ ์คํฌ๋ฆฝํธ๋ฅผ ํ ๋ฒ๋ง ์์ฒญํฉ๋๋ค. ๋๋ webpack 2๋ฅผ ์ฌ์ฉํ์ฌ ์ด๊ฒ์ํ๊ณ ์ ์๋ํฉ๋๋ค. ์ฌ๊ธฐ์ ์ข์ ์ผ์ ํด์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค.
@IAMtheIAM ๊ฐ์ฌํฉ๋๋ค. @efstathiosntonas์ ๋ํ ๋ด ์ธ์ฌ๋ ๐ฅ
์ธ๋ฑ์ค ํ์ผ์ด๋ ๋ค๋ฅธ ๊ณณ์์ ๋ค์ ํธ์ถํ๋ ๊ฒฝ์ฐ ์ ๊ฑฐํด์ผํฉ๋๋ค.
ํ๋ก์ ํธ์์ ํ ๋ฒ๋ง ํธ์ถํ๋ฉด๋ฉ๋๋ค.
์๋
ํ์ธ์, ์ฌ๋ฌ๋ถ, ์ ๊ฐ ๋ ๋ฒ์งธ๋ก์ง๋๋ฅผ ํฌํจ์ํจ ์ฅ์๋ฅผ ์ฐพ๋ ๋ฐฉ๋ฒ์ ์๋ ์ฌ๋ ์๋์?
๋ด๊ฐ ๋ฐฉ๋ฌธํ ์ฒซ ํ์ด์ง์์ง๋๊ฐ ์์ผ๋ฉด ๋ณผ ์ ์์ต๋๋ค. ํ์ง๋ง ๋ด๊ฐ ๋จผ์ ๋ฐฉ๋ฌธํ์ง๋๊ฐ์๋ ํ์ด์ง๊ฐ ์๋๋ผ๋ฉด ๊ด์ฐฎ์ต๋๋ค.
๊ฐ์ฌ
์ฝ๋ ์ํ์ด ์์ผ๋ฉด @Riasets ๋ฅผ ๋๊ธฐ๊ฐ ์ด๋ ค์ธ ๊ฒ์ ๋๋ค.
Repo ๋งํฌ : https://github.com/Riasets/test
์๋ฑํ ์ฝ๋๋ก ์ฃ์กํฉ๋๋ค
๋ฟก ๋นต๋จ
๋ก๊ทธ์ธ : [email protected]
๋น๋ฐ๋ฒํธ : test1234
@Riasets ๋ด๊ฐ ๋น์ ์ ์ฑ์ ๋ณต์ ํ๊ณ ์คํํ๋๋ฐ, ์์ฃผ ์ข์ ๋ณด์ธ๋ค. ๋์๊ฒ๋ ๋ก๊ทธ์ธ ํ ์ฆ์์ง๋๊ฐ๋ก๋๋๊ณ ๋ค๋ฅธ ํ์ด์ง๋ก ๋ณ๊ฒฝํ๋ฉด์ง๋๋ ์ ์์ ์ผ๋ก๋ก๋๋ฉ๋๋ค. ๋ฌธ์ ๊ฐ ๋ณด์ด์ง ์์ต๋๋ค. ๋ ๋ช ํํ๊ฒ ์ค๋ช ํด ์ฃผ์๊ฒ ์ต๋๊น?
@IAMtheIAM ๋ก๊ทธ์ธ ํ์ด์ง๊ฐ ์ฒ์์ด์๊ณ ์ง๋ ํ์ด์ง๊ฐ ๋ ๋ฒ์งธ์์ต๋๋ค. ์ด ๊ฒฝ์ฐ์ง๋๊ฐ๋ก๋๋ฉ๋๋ค. ๊ทธ๋ฌ๋ ์๋ฅผ ๋ค์ด ์ด๋ฏธ ์น์ธํ๊ณ / ํ ํ์ด์ง๋ก ์ด๋ํ๋ ค๊ณ ํ๋ฉด์ง๋๊ฐ๋ก๋๋์ง ์์ต๋๋ค. ๋๋์ง๋๋ก ํ์ด์ง๋ฅผ ์๋ก ๊ณ ์นจํ๋ฉด๋ก๋๋์ง ์์ต๋๋ค. ๋ํ ๊ฐ๋ฐ์ ๋๊ตฌ 2์์ Google์ง๋์ ๋์ผํ ์คํฌ๋ฆฝํธ๋ฅผ ๋ณผ ์ ์์ต๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
app.module.ts ๊ฐ์ ธ ์ค๊ธฐ์์ ๋ค์์ ์ถ๊ฐํ์ญ์์ค.
AgmCoreModule.forRoot({ apiKey: 'xxxxxx', libraries: ['places'] })
(๋ฌผ๋ก ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ ๊ฑฐ ํ ์ ์์ต๋๋ค : [ 'places'])
๊ทธ๋ฐ ๋ค์ ๊ณต์ ๋ชจ๋์ ๋ค์์ ์ถ๊ฐํ์ญ์์ค.
์์ ํ
AgmCoreModule
๋ฐ ์์ถ :
AgmCoreModule
๋ค์
You have included the Google Maps API multiple times on this page. This may cause unexpected errors.
์ฌ๋ผ์ง