Here we have a valuable resource that I'd like to share:
hq.factory('AvgUsersPerWeek', function ($resource) {
return $resource('/HQ/Graph/GetLoggedinUsersPerWeek')
});
This is where the controller comes into play:
hq.controller('AvgUsersPerWeekCtrl', function ($scope, AvgUsersPerWeek) {
$scope.xkey = 'Period';
$scope.ykeys = ['CountUsers'];
$scope.labels = ['Aantal'];
$scope.myModel = AvgUsersPerWeek.query();
/*
//example dataset that works, the fetched data has the same structure
[
{ "Period": "2013-04", "CountUsers": 2407 },
{ "Period": "2013-03", "CountUsers": 3351 },
{ "Period": "2013-02", "CountUsers": 2469 },
{ "Period": "2013-01", "CountUsers": 2246 },
{ "Period": "2012-12", "CountUsers": 3171 },
{ "Period": "2012-11", "CountUsers": 2155 },
{ "Period": "2012-10", "CountUsers": 1226 },
{ "Period": "2012-09", "CountUsers": 2245 }
]; */
})
It's worth noting that when I replace AvgUsersPerWeek.query() with the dataset below, everything functions correctly. So it seems something might be amiss with my resource (which is being fetched according to Fiddler). However, the value isn't showing up in my chart.
I've made sure that the example dataset matches the structure of the dataset retrieved by the $resource.
I won't include the HTML here since it's functional. My suspicion is that there's an issue with how I'm utilizing $resources.