im using AngularJS for value calculator on the client side. I want to update the main value of this calculator every 5 minutes using setInterval().
My AngularJS code is:
$http({method: 'GET', url: '../assets/sources.json'}).success(function(data)
{
$scope.values = data; // response data
$scope.getSourceValue = function(){
if ($scope.source == "test") {
return $scope.values.test["last"]
} else if ($scope.source == "test1"){
return $scope.values.test1["last"]
} else if ($scope.source == "test2"){
return $scope.values["test2"]["last"]
} else {
return -1
};
} // getSource
}
On client side:
<strong><h1> {{getSourceValue()|currency}}</strong></h1>
Can someone point me in the right direction?
Thanks in advance.
UPDATE:
{
"timestamp": "Sun Sep 14 2014, 01:40:03",
"bitstamp": {
"display_URL": "http://www.bitstamp.net",
"display_name": "Bitstamp",
"currency": "BTC",
"last": 477.6
},
"btc-e": {
"display_URL": "http://www.btc-e.com",
"display_name": "BTC-e",
"currency": "BTC",
"last": 471.5
},
"bitcoinaverage": {
"display_URL": "http://api.bitcoinaverage.com",
"display_name": "BitcoinAverage",
"currency": "BTC",
"last": 479.23
},
"geeklab": {
"display_URL": "http://ws.geeklab.com.ar",
"display_name": "Geeklab",
"currency": "ARS",
"blue": 14.35
}
}