この
はSRC /アプリ/ app.module.tsを変更し、
import { HttpModule } from '@angular/http';
をインポート、輸入、使用することができます。その後
@NgModule({
declarations: [
MyApp,
HomePage
],
imports: [
BrowserModule,
HttpModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {}
に追加行うにはHTTPモジュールからの角度。あなたのPage.tsで
インポートモジュールとさらにあなたはJSONオブジェクト
var jsonobject = JSON.parse(data)
に戻っJSON文字列に変換することができ、この
import { Http } from '@angular/http';
constructor(public navCtrl: NavController, public http: Http) {
let url = "https://www.reddit.com/r/gifs/new/.json?limit=10";
this.http.get(url).map(res => res.json()).subscribe(data => {
console.log(data);
});
}
のようにそれを使用して、代わりにあなたができますIONIC NATIVE HTTP PLUGIN
乾杯:D
ありがとうございます。私はあなたを愛し、ホモはありません:) – adrian
心配しなくても、大いに愛:D –