Ionic framework 如何将参数传递到url
我有一些屏幕,在那里我会调用一些url。但是我知道如何使用get调用函数并显示数据,但是现在我想用url发送参数 这里是我的url。我需要发送参数:Ionic framework 如何将参数传递到url,ionic-framework,hybrid-mobile-app,ionic3,Ionic Framework,Hybrid Mobile App,Ionic3,我有一些屏幕,在那里我会调用一些url。但是我知道如何使用get调用函数并显示数据,但是现在我想用url发送参数 这里是我的url。我需要发送参数: this.passingdata = { CatID: "2" }; 我需要将上述参数发送到下面的获取url函数 constructor(public viewCtrl: ViewController, public modalCtrl: ModalController, private http: Http, public loadingCt
this.passingdata = { CatID: "2" };
我需要将上述参数发送到下面的获取url函数
constructor(public viewCtrl: ViewController, public modalCtrl: ModalController, private http: Http, public loadingCtrl: LoadingController) {
let that = this
let loader = this.loadingCtrl.create({
content: "Please wait..."
});
loader.present();
that.http.get('http://www.example.com/api/tackj.php').map((res) => res.json()).subscribe((data: any) =>{
that.questions = data.QuestionsList;
loader.dismiss();
})
}
ionViewDidLoad() {
let that = this;
that.slides.lockSwipes(true);
that.slides.enableKeyboardControl(false);
}
提前感谢 如果您想传递一些参数,很可能是post方法,那么您可以将数据作为第二个参数传递给http.post方法。因此,您需要确定API是post方法还是get方法。 请参阅此链接
好的,使用相同的代码告诉我如何通过参数表……我们可以将该值更改为
post
而不是get