如何将参数传递给url

时间:2017-05-27 16:21:35

标签: ionic-framework hybrid-mobile-app ionic3

我有一些屏幕,我会打电话给一些网址。但我知道如何使用get调用函数并显示数据。但现在我想用url发送参数。

这里我的url.i需要发送参数:

this.passingdata = { CatID: "2" };

以上参数我需要发送到下方获取网址功能

 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);
  }

提前感谢!!

1 个答案:

答案 0 :(得分:0)

如果你想传递一些参数,很可能是post方法,那么你可以将数据作为第二个参数传递给http.post方法。因此,您需要确定API是post方法还是get方法。 请参阅此链接 AngularJS passing data to $http.get request

相关问题