我需要把这个功能
function GraphsCtrl($scope, $http, $q){
$scope.chartExistencias = {
dataSource: {
load: function () {
var def = $.Deferred();
$http({ method: 'GET', url: ng.api + '/llantas/graficos/'+1 }).success(function (data) {
for(var i = 0; i<data.data.length; i++){
totalEx = data.data[i].count + totalEx;
}
$scope.totalEx = totalEx;
def.resolve(data.data);
});
return def.promise();
}
}
}
在此控制器内
define([], function() {
return ['$scope', '$rootScope', '$http', '$utilities', '$appCache', '$q', function($scope, $rootScope, $http, $utilities, $appcache, $q) {
}
适用于特定视图,重点是这是我的html
<div ng-controller ='GraphsCtrl' >
<div dx-chart='chartExistencias' id='chartExistencias' s tyle="max-width:510px; min-width:400px; height:300px; float:left;"></div>
</div>
我正在使用ng控制器,我该怎么办?