【问题标题】:Ionic Framework - Google Map error离子框架 - 谷歌地图错误
【发布时间】:2018-02-06 01:49:25
【问题描述】:

我最近想在几个月后重新构建我的应用程序,并且我已经从 ionic 2 升级到 Ionic 3.9.2,这很烦人,我已经让所有工作都接受了我的谷歌地图区域。

我已按照https://ionicframework.com/docs/native/google-maps/ 的说明进行操作

导入时我得到以下信息。我正在将其导入“提供者”。

import { NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';
import { AngularFireModule } from 'angularfire2';

import { IonicStorageModule } from '@ionic/storage';

import {
 GoogleMaps,
 GoogleMap,
 GoogleMapsEvent,
 LatLng,
 CameraPosition,
 MarkerOptions,
 Marker
} from '@ionic-native/google-maps';

import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';

import { HttpModule } from '@angular/http';
import { AdMobFree } from '@ionic-native/admob-free';

// diretives and providers
import { Loader } from '../providers/loader';
import { Nl2br } from '../pipes/nl2br';
import { HoursMinutesSeconds } from '../pipes/hours-minutes-seconds';
import { AuthenticatorService } from '../providers/authenticator';
import { Categories } from '../providers/categories';
import { Ionic2Rating } from 'ionic2-rating';

import { Geolocation } from '@ionic-native/geolocation';
import { SocialSharing } from '@ionic-native/social-sharing';
import { InAppBrowser } from '@ionic-native/in-app-browser';

// Custom pages generated by ionic generator
import { HomePage } from '../pages/home/home';
import { SettingsPage } from '../pages/settings/settings';
import { ShoppingListPage } from '../pages/shopping-list/shopping-list';
import { TabsPage } from '../pages/tabs/tabs';
import { SearchPage } from '../pages/search/search';
import { DetailsPage } from '../pages/details/details';
import { CategoryPage } from '../pages/category/category';
import { IntroPage } from '../pages/intro/intro';

// Authentication
import { LoginPage } from '../pages/authentication/login/login';
import { RegistrationPage } from '../pages/authentication/registration/registration';

import { Config } from './config'

@NgModule({
  declarations: [
    MyApp,
    HomePage,
    TabsPage,
    SearchPage,
    ShoppingListPage,
    DetailsPage,
    CategoryPage,
    SettingsPage,
    LoginPage,
    RegistrationPage,
    Nl2br,
    HoursMinutesSeconds,
    Ionic2Rating,
    IntroPage
  ],
  imports: [
    BrowserModule,
    HttpModule,
    IonicModule.forRoot(MyApp),
    IonicStorageModule.forRoot(),
    AngularFireModule.initializeApp(Config.FIREBASE_CONFIG)
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    HomePage,
    TabsPage,
    SearchPage,
    ShoppingListPage,
    CategoryPage,
    DetailsPage,
    LoginPage,
    RegistrationPage,
    SettingsPage,
    IntroPage
  ],
  providers: [
    StatusBar,
    Geolocation,
    SocialSharing,
    GoogleMaps,
    GoogleMap,
    GoogleMapsEvent,
    LatLng,
    CameraPosition,
    MarkerOptions,
    Marker,
    InAppBrowser,
    SplashScreen,
    AdMobFree,
    Loader,
    AuthenticatorService,
    Categories,
    {provide: ErrorHandler, useClass: IonicErrorHandler}
  ]
})
export class AppModule {}

请参考此文件中的谷歌地图导入。

如果有人可以提供帮助,那就太好了, 谢谢

【问题讨论】:

  • 请提供您的代码

标签: angular google-maps cordova ionic-framework ionic3


【解决方案1】:

您只需要导入 GoogleMaps ,其他的不需要。 您的代码将是:

import { NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';
import { AngularFireModule } from 'angularfire2';

import { IonicStorageModule } from '@ionic/storage';

import {GoogleMaps} from '@ionic-native/google-maps';

import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';

import { HttpModule } from '@angular/http';
import { AdMobFree } from '@ionic-native/admob-free';

// diretives and providers
import { Loader } from '../providers/loader';
import { Nl2br } from '../pipes/nl2br';
import { HoursMinutesSeconds } from '../pipes/hours-minutes-seconds';
import { AuthenticatorService } from '../providers/authenticator';
import { Categories } from '../providers/categories';
import { Ionic2Rating } from 'ionic2-rating';

import { Geolocation } from '@ionic-native/geolocation';
import { SocialSharing } from '@ionic-native/social-sharing';
import { InAppBrowser } from '@ionic-native/in-app-browser';

// Custom pages generated by ionic generator
import { HomePage } from '../pages/home/home';
import { SettingsPage } from '../pages/settings/settings';
import { ShoppingListPage } from '../pages/shopping-list/shopping-list';
import { TabsPage } from '../pages/tabs/tabs';
import { SearchPage } from '../pages/search/search';
import { DetailsPage } from '../pages/details/details';
import { CategoryPage } from '../pages/category/category';
import { IntroPage } from '../pages/intro/intro';

// Authentication
import { LoginPage } from '../pages/authentication/login/login';
import { RegistrationPage } from '../pages/authentication/registration/registration';

import { Config } from './config'

@NgModule({
  declarations: [
    MyApp,
    HomePage,
    TabsPage,
    SearchPage,
    ShoppingListPage,
    DetailsPage,
    CategoryPage,
    SettingsPage,
    LoginPage,
    RegistrationPage,
    Nl2br,
    HoursMinutesSeconds,
    Ionic2Rating,
    IntroPage
  ],
  imports: [
    BrowserModule,
    HttpModule,
    IonicModule.forRoot(MyApp),
    IonicStorageModule.forRoot(),
    AngularFireModule.initializeApp(Config.FIREBASE_CONFIG)
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    HomePage,
    TabsPage,
    SearchPage,
    ShoppingListPage,
    CategoryPage,
    DetailsPage,
    LoginPage,
    RegistrationPage,
    SettingsPage,
    IntroPage
  ],
  providers: [
    StatusBar,
    Geolocation,
    SocialSharing,
    GoogleMaps,
    InAppBrowser,
    SplashScreen,
    AdMobFree,
    Loader,
    AuthenticatorService,
    Categories,
    {provide: ErrorHandler, useClass: IonicErrorHandler}
  ]
})
export class AppModule {}

抱歉英语不好。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-07-18
    • 1970-01-01
    • 2019-07-15
    • 2015-11-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-15
    相关资源
    最近更新 更多