When using $http.get I no longer see data in my bar graph. If I remove $http.get and just call the url my data appears just fine. Any ideas what I am doing wrong?
AngularJS
var app = angular.module('customCharts', ['dx']);
function ChartController($scope, $http) {
$http.get("http://localhost:53640/Home/PostChart")
.success(function (data) {
$scope.productSettings = {
dataSource: data,
title: 'Displays Product Costs for items in our Database',
series: {
argumentField: "Name",
valueField: "Cost",
type: "bar",
color: '#008B8B'
},
commonAxisSettings: {
visible: true,
color: 'black',
width: 2
},
argumentAxis: {
title: 'Items in Product Store Database'
},
valueAxis: {
title: 'Dollor Amount',
valueFormat: 'currency'
}
};
});
}
HTML
<div ng-app="customCharts">
<div ng-controller="ChartController">
<div dx-chart="productSettings"></div>
</div>
</div>
JSON
[{"Name":"Learn SQL Server 2014","Cost":34.95},{"Name":"ASUS PC","Cost":499.99},{"Name":"SQL Server 2014","Cost":600.00}]
dataactually the data, or is it actually the response, and you want to usedata.data(or renamedatatoresponseand doresponse.data)