We help IT Professionals succeed at work.

How do I refresh ajax data from controller using angular?

maccaj51
maccaj51 asked
on
171 Views
Last Modified: 2017-05-12
Hi Experts,

I have the following code which gets data from my api and works great.

    var app = angular.module('2moro', []);
    app.controller('results', function($scope, $http) {
      $http.get('/api/snow.php').then(function (response) { 
	    $scope.results = response.data.results; 
      });
    });

Open in new window


How would I then refresh the data using setInterval or such a like?

Thanks for any help
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2017
Distinguished Expert 2019
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Thanks so much. Worked Great
CERTIFIED EXPERT
Most Valuable Expert 2017
Distinguished Expert 2019

Commented:
You are welcome.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.