cloud-angular没有导出成员提供Cloud

时间:2016-11-16 13:50:05

标签: node.js angular ionic-framework ionic2

情况

我已经设置了一个空白的应用。已安装@ionic/cloud-angular并已导入provideCloud

但是我收到以下错误:

cloud-angular has no exported member 'provideCloud' 

cloud-angular has no exported member provideCloud

(我对ionicBootstrap有类似的错误)

THE STEPS:

  1. 离子启动whateva blank --v2

  2. npm install @ ionic / cloud-angular --save

  3. ionic io init

  4. 导入provideCloud

  5. 代码:

    import { provideCloud, CloudSettings } from '@ionic/cloud-angular';
    import { ionicBootstrap, Platform } from 'ionic-angular';
    

    离子信息

    Cordova CLI: 6.4.0
    Ionic Framework Version: 2.0.0-rc.2
    Ionic CLI Version: 2.1.8
    Ionic App Lib Version: 2.1.4
    Ionic App Scripts Version: 0.0.44
    ios-deploy version: 1.9.0
    ios-sim version: 5.0.11
    OS: OS X El Capitan
    Node Version: v4.6.0
    Xcode version: Xcode 7.3.1 Build version 7D1014
    

    Package.json依赖项:

    "dependencies": {
        "@angular/common": "2.1.1",
        "@angular/compiler": "2.1.1",
        "@angular/compiler-cli": "2.1.1",
        "@angular/core": "2.1.1",
        "@angular/forms": "2.1.1",
        "@angular/http": "2.1.1",
        "@angular/platform-browser": "2.1.1",
        "@angular/platform-browser-dynamic": "2.1.1",
        "@angular/platform-server": "2.1.1",
        "@ionic/cloud-angular": "^0.7.0",
        "@ionic/storage": "1.1.6",
        "ionic-angular": "2.0.0-rc.2",
        "ionic-native": "2.2.3",
        "ionicons": "3.0.0",
        "rxjs": "5.0.0-beta.12",
        "zone.js": "0.6.21"
      },
      "devDependencies": {
        "@ionic/app-scripts": "0.0.44",
        "typescript": "2.0.6"
      },
    

    问题:

    为什么我收到错误?

    我刚刚设置了一个新的空白应用..设置有问题吗?

    谢谢!

1 个答案:

答案 0 :(得分:5)

当版本 0.7.0 发布时,provideCloud已替换为CloudModule,您可以在code中看到。

设置云设置的新方法如下

import { CloudSettings, CloudModule } from '@ionic/cloud-angular';

const cloudSettings: CloudSettings = {
  'core': {
    'app_id': 'APP_ID'
  }
};

@NgModule({
  declarations: [ ... ],
  imports: [
    IonicModule.forRoot(MyApp),
    CloudModule.forRoot(cloudSettings)
  ],
  bootstrap: [IonicApp],
  entryComponents: [ ... ],
  providers: [ ... ]
})
export class AppModule {}