AngularJS onclick Polling Spring MVC
AngularJS provide $timeout service which can be use to refresh data on client page. For this demo we will use Spring MVC framework on server side and from client page we will make request to the server on every second. Every request server will return random integer value and we will put this value on client page.
- Sample maven project structure:
- AngularJSPollController.java : Server side Spring MC controller class where client will make request and it will return random integer data in response:
- For more details $timeout service please visit AngularJS API here
Download project: AngularJSPolling