While attempting to utilize an int value from a JSON file:
{
"buenos":274.0,
"desaprobacion":0.13564668769716087,
"malos":43.0,
"proporcion":6.372093023255814
}
within the app:
var app = angular.module('angularSpa', ['ngRoute','nvd3'])
.service('QueryService', function($http){
var urlBase = 'http://localhost:8080/tweets';
this.getJson = function(){
return $http.get(urlBase+"/compañias/vtr");
}; //This code has been successfully used in another controller to display values within an html
//... more functions
})
in the controller:
function getValue(){
QueryService.getJson()
.success(function(data){
return JSON.parse(data.buenos); // always returns NaN here
})
.error(function(error){
$scope.status = 'Error at query';
console.log('error');
});
}
Could there be an issue with the return
of getValue()
?