2017-03-08 94 views
0

我使用离子V2,问题是,当我发送HTTP请求它的浏览器无法显示离子http请求没有被解雇

export class Auth { 

    constructor(public http: Http) { 
    console.log('Hello Auth Provider'); 
    } 

    login(){ 
    console.log('Hello'); 
    this.http.post('localhost:8100/api/User/getAll/' , '' , {}); 

    } 

} 

我火登录方法,它安慰了“你好”,但不会触发HTTP

这意味着离子不点火HTTP调用,我已经安装了白名单的插件,编辑XML文件,并安装Chrome扩展,但没有什么那些解决问题

+0

添加代码作为图像是高度皱眉。请将您的代码添加为文本。 –

+0

编辑@Sardar_Usama – wkasem2

回答

0

你必须map()则回应中使用的subscribe() od,因为角度Http使用Observables。检查此

this.http.post('localhost:8100/api/User/getAll/' , '' {}) 
.map(res => res.json()) 
.subscribe(
    response => { 
     console.log(response); 
    }, 
    error => {console.log(error) 
    }); 
+0

工作! , 谢谢 – wkasem2