我正在使用离子v2,问题是当我发送http请求时它没有显示在chrome
上 export class Auth {
constructor(public http: Http) {
console.log('Hello Auth Provider');
}
login(){
console.log('Hello');
this.http.post('localhost:8100/api/User/getAll/' , '' , {});
}
}
我启动登录方法,它控制掉'Hello'但不激活http
这意味着离子没有触发http调用,我已经安装了白名单插件,编辑xml文件并安装了chrome扩展,但没有解决这个问题
答案 0 :(得分:0)
您必须map()
响应然后使用subscribe()
方法,因为角度Http使用Observables
。检查一下
this.http.post('localhost:8100/api/User/getAll/' , '' {})
.map(res => res.json())
.subscribe(
response => {
console.log(response);
},
error => {console.log(error)
});