As a newcomer to AngularJS, I am encountering an error when attempting to send a post request to my localhost server. The error message states [ts] cannot find name 'map' and cannot find name 'subscribe'. Any assistance in understanding and resolving this issue would be greatly appreciated. Thank you.
login.ts
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { Http ,Headers ,HttpModule} from '@angular/http';
import 'rxjs/add/operator/map';
/**
* Generated class for the Login page.
*
* See http://ionicframework.com/docs/components/#navigation for more info
* on Ionic pages and navigation.
*/
@IonicPage()
@Component({
selector: 'page-login',
templateUrl: 'login.html',
})
export class Login {
constructor(public navCtrl: NavController, public navParams: NavParams,public http:Http) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad Login');
}
ionViewidData(){
let headers= new Headers();
headers.append('Content-Type','application/json');
let body = {
device:"Mobile",
id:"10077",
password:"leechan2"
};
console.log(body);
this.http.post('http://0.0.0.0:2800/login',JSON.stringify(body),{headers:headers})
.map(res => res.json())
.subscribe(data =>{
console.log(data);
});
}
}