Ionic 2のAngular2-Jwtを設定しようとしています。今それはしません。私は、問題を引き起こしているwihchイオン性ストレージへの変更があった知っているが、私は以下のコードを変換する方法を理解していない:ストレージのすべてのパラメータを解決できません:(?) - Angular JWT App Module
import { BrowserModule } from '@angular/platform-browser';
import { Http } from '@angular/http';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { AuthHttp, AuthConfig } from 'angular2-jwt';
import { ElasticModule } from 'angular2-elastic';
import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
import { NumberBoard } from '../components/number-board/number-board';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { CloudSettings, CloudModule } from '@ionic/cloud-angular';
import { IonicStorageModule, Storage } from '@ionic/storage';
let storage: Storage = new Storage();
export function getAuthHttp(http) {
return new AuthHttp(new AuthConfig({
headerName: 'token',
noTokenScheme: true,
globalHeaders: [{'Accept': 'application/json'}],
tokenGetter: (() => storage.get('token'))
}), http);
};
const cloudSettings: CloudSettings = {
'core': {
'app_id': 'c3890396'
}
};
@NgModule({
declarations: [
MyApp,
HomePage,
NumberBoard
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
CloudModule.forRoot(cloudSettings),
IonicStorageModule.forRoot()
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler},
{provide: AuthHttp, useFactory: getAuthHttp, deps: [Http]},
]
})
export class AppModule {}
Package.json:
{
"name": "ionic-hello-world",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/common": "4.0.0",
"@angular/compiler": "4.0.0",
"@angular/compiler-cli": "4.0.0",
"@angular/core": "4.0.0",
"@angular/forms": "4.0.0",
"@angular/http": "4.0.0",
"@angular/platform-browser": "4.0.0",
"@angular/platform-browser-dynamic": "4.0.0",
"@ionic-native/core": "3.4.2",
"@ionic-native/crop": "^3.4.4",
"@ionic-native/image-picker": "^3.4.4",
"@ionic-native/splash-screen": "3.4.2",
"@ionic-native/status-bar": "3.4.2",
"@ionic/cloud-angular": "^0.11.0",
"@ionic/storage": "2.0.1",
"angular2-elastic": "^0.13.0",
"angular2-jwt": "^0.2.0",
"ionic-angular": "3.0.0",
"ionicons": "3.0.0",
"rxjs": "5.1.1",
"sw-toolbox": "3.4.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@ionic/app-scripts": "1.3.0",
"typescript": "~2.2.1"
},
"cordovaPlugins": [
"cordova-plugin-whitelist",
"cordova-plugin-console",
"cordova-plugin-statusbar",
"cordova-plugin-device",
"cordova-plugin-splashscreen",
"ionic-plugin-keyboard"
],
"cordovaPlatforms": [],
"description": "Rediyal-Business: An Ionic project"
}
を試してみてください、あなたの 'package.json'ファイルを表示することができますか? – Sampath
@Sampathを完了しました:) –
あなたは 'Ionic 3 beta'を使用していますか? – Sampath