How to simulate a long task with angularjs? -
I am new to AngularJS I am testing the resolution to display partial views after receiving the response from the server (Is this a good way to do it?).
How to work better, I'd like to add a break in the service that uses $ $ resource to get data displayed by partial view (5 seconds) in Java I sleep method Will use. Before performing the following line of code, there is an easy way to wait with AngularJS for 5 seconds (before using $ $ in my service)?
Something like this will wait:
function instance controller ($ of Radius, $ timeout, $ Q) {function get () {var request = $ q.defer (); Console.log ('waiting ...'); $ Timeout (function () {request.resolve ({data: 1});}, 5000); Return request. } get receive (). Then (function (feedback) {console.log (response.data);}); } Actually you set up a $ q.defer () , and then fix it when you want all the things to load ( Or in this case when the time ended). You then use the then function with the data you solve.
Comments
Post a Comment