Restangular is slowly requesting API for data

I am completely new to both JavaScript and AngularJS and am trying to figure out how to debug the speed problem I have:

I have a data service defined in my AngularJS app that calls a JSON RESTful API for data to populate <select>

in a UI router view.

When the page loads for the first time, which I simulate by disabling caching in Chrome and doing shift-F5 to reload the page, the parameter list <select>

takes 8 to 15 seconds to populate. (Subsequent loads with caching enabled do not get latency)

Looking at the logs, the delay is in getting the html template for the partial for ui-view

and hitting the API, so it's not that the API is slow (it's on localhost and the test dataset is only four records), that there is a huge delay between loading the partial and initiating API call. I have no errors in the javascript console or in any of the server logs.

How can I track where the deferral is coming from?

The Chrome Developer Tools tab shows that the vast majority of the time for XHR lookups is on hold.

Are there any other tools I can use to debug this?

+3


source to share





All Articles