How to use angular2 http API for tracking downloading progress status

1,323 views
Skip to first unread message

Vinu Prasad

unread,
Oct 13, 2017, 7:57:21 AM10/13/17
to Angular and AngularJS discussion
Hii..everyone angular2 . There are many fetching process takes place in my project from server-side. I want to display the data fetching status at client side . Plase help me how can I make it possible.

in my Component.ts I Used

constructor(private service: ReturnJsonService){}
Get(){
//alert(JSON.stringify(id));
this.service.Getdata().subscribe(data => this.obj1 = data);
this.service.Getname().subscribe(data => this.obj2 = data);
this.service.Getcost().subscribe(data => this.obj3 = data);

// these are the 3 fetching process that i used . I want to display fetching status in the screen
this.msg = "All the Details Fetched..!"
}




in ReturnJsonService.ts


export class ReturnJsonService {
public req;
constructor( private http :Http) { }
Getdata(): Observable<any> {
return this.http.get('http://192.168.0.101:8000/data')
.map(response => response.json())

}
Getname(): Observable<any> {
return this.http.get('http://192.168.0.101:8000/Name')
.map(response => response.json())
}
Getcost(): Observable<any> {
return this.http.get('http://192.168.0.101:8000/cost')
.map(response => response.json())
}
}



thanks in advance..

Sander Elias

unread,
Oct 13, 2017, 9:49:18 AM10/13/17
to Angular and AngularJS discussion
Hi Vinu,

I do something similar in one of my demo's, have a look at it.
If you have still questions after that, I will answer them. (I guess you do, its a tad more complex code!)

Regards
Sander

Zlatko Đurić

unread,
Oct 14, 2017, 6:29:05 AM10/14/17
to Angular and AngularJS discussion


On Friday, October 13, 2017 at 1:57:21 PM UTC+2, Vinu Prasad wrote:
Hii..everyone angular2 . There are many fetching process takes place in my project from server-side. I want to display the data fetching status at client side . Plase help me how can I make it possible.


I'm not sure I understand, are you're trying to show progress bars for multiple downloads? Maybe try something with HttpClient (Angular 4.3+): https://plnkr.co/edit/8WzFdGtHboJg1ZuY63d5?p=preview

Vinu Prasad

unread,
Oct 15, 2017, 4:17:34 AM10/15/17
to ang...@googlegroups.com
Thanks a lot @ Zlatko this is what i was looking for..!

Virus-free. www.avast.com

--
You received this message because you are subscribed to a topic in the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/TA1orf896rE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+unsubscribe@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.



--
Vinu Prasad
 
Reply all
Reply to author
Forward
0 new messages