0

I want the data to get automatically updated when a new data get updated in the database without using the SET Interval function.

var myVar = setInterval(myTimer ,1000);

function myTimer() {
    $http.get('URL CALL', { params: { "key1": "value1"} })
         .success(function(data) {
             document.getElementById('available').value=data.status;
         })
}
LundinCast
  • 9,412
  • 4
  • 36
  • 48

1 Answers1

1

Without setInterval function, Then try setTimeout... Just LOL... Without setInterval & setTimeout you can do it with websocket.

In industry, When you want to deal with real time process It's good to go with websocket.

Read More about websockets

BadPiggie
  • 5,471
  • 1
  • 14
  • 28