Reputation: 15
I Have Tried
http.get('http://192.168.0.26:9000/api/task/counttask?projectid=-1&Teamid=-1&RoleId=-1&status=1&PID=-1&mytasks=0&alltasks=0&page=1&row=15&priorityid=-1&typeid=-1&taskname=&JSON&_=1471520478215')
.map((res: Response) => res.json())
.subscribe(res => this.result = res);
alert(this.result);
I am Getting Error But if You run this below Url in Browser it will give you the output
192.168.0.26:9000/api/task/counttask?projectid=-1&Teamid=-1&RoleId=-1&status=1&PID=-1&mytasks=0&alltasks=0&page=1&row=15&priorityid=-1&typeid=-1&taskname=&JSON&_=1471520478215
How to Handle this Request ??
Upvotes: 1
Views: 50
Reputation: 7060
First things first: It'd be nice to know the actual error.
Your alert()
is executed right away. So the request hasn't finished yet.
Try this:
.subscribe(res => {
this.result = res;
console.log(this.result);
});
edit: you should use console.log (or an actual debugger), because alert() does not resolve objects. It might just say "[object Object]".
Upvotes: 1