//you need to import this//
import { Http, Headers, URLSearchParams, Request, RequestMethod, RequestOptions } from '@angular/http';
constructor(public navCtrl: NavController, private http: Http, private navParams: NavParams){}
//login function
Login(username, password) {
//body for your details to be verified
let data = {
"username": username,
"password": password,
}
//here you are making an api call//
return this.http
.post(apiUrl + Login, data)
.map(res => res.json())
.subscribe(
data => {
},
err => {
console.log("ERROR!: ", err);
}
);
}
可能你需要找到一個不同的方式來調用你的api,可能會工作 – devanshsadhotra
爲什麼這個插件不適用於POST方法? – rayashi
這個插件是完美的,但是你把它導入到TS文件中嗎? – devanshsadhotra