I am encountering an issue with sending data to a controller from a service that calls an API. To demonstrate this problem, I have utilized http://embed.plnkr.co/jEQMch/ as the basis of my sample application and tweaked it to develop a bullet chart.
The structure of my controller is as follows:
var app = angular.module('plunker', ['nvd3', 'gridster', 'plunker.services']);
app.controller('MainCtrl', function($scope, $timeout, DataService) {
// Controller logic goes here
});
This is how my dataservice appears:
angular.module('plunker.services', [])
.factory('DataService', function($http, $q) {
return{
bulletChart: {
options: bulletChartOptions,
data: bulletChartData
}
};
/**
* Data & Options Generators
*/
// Functions for generating options and data for the bullets chart
});
When using the 'bulletChartDataTest
' function in my service, the graph displays correctly:
https://i.sstatic.net/JnNOd.png
However, when switching to 'bulletChartData
', the graph does not appear to be working properly. It seems like 'data: bulletChartData
' is causing the issue. Can anyone provide guidance on what might be wrong with my 'bulletChartData
' method?