Reputation: 750
I have a listing page. WHere each listing has comments. I am using AngularJS routes to load the content http://example.com/#mycategory
The Problem: When user navigates to different category (Say: http://example.com/#mycategory22 ), If i want to load the comments inside every items listed (Below image), do i need to make ajax calls?.
According to the below example if i make ajax calls to load comments then it will be 3 ajax calls.
How to handle this problem.
Upvotes: 0
Views: 111
Reputation: 4255
Here is what I would do:
If a response takes ~ 1,5 seconds you can display a new category every 1,5 seconds. This seems short enough for not annoying the user, because it takes longer than 1.5 seconds to grasp one category and then there is the next one.
Upvotes: 0
Reputation: 3210
You can save your multiple ajax call by fetching all the comments at once using associated table id with comment. If I assume coupon is associated with comment so you should use coupon id to fetch associated comments. All you need to pass coupon id with request (URL) to fetch comments.
Rather using jQuery Ajax, use Angular $http service for this. You can checkout Processing $http response in service for help on this.
Upvotes: 1