2
我能夠在本地查看數據,但是當我打開Windows Azure雲服務應用程序,不再有JSON數據傳遞到我的圖表(http://dashboardexample.cloudapp.net/Home/Product)。我在控制檯中收到一條消息:「控制器名稱應該以大寫字母開頭,並以後綴控制器結尾,例如:UserController。 模塊名稱的最佳實踐是使用lowerCamelCase,檢查名稱」dx「。不確定是什麼導致了這個問題。有什麼想法嗎?微軟Azure與AngularJS - 數據未顯示在圖表
AngularJS
var app = angular.module('customCharts', ['dx']);
app.controller("ChartController", function ($scope, $http, $q) {
$scope.productSettings = {
dataSource: new DevExpress.data.DataSource({
load: function() {
var def = $.Deferred();
$http({
method: 'GET',
url: 'http://localhost:53640/Home/PostChart'
}).success(function (data) {
def.resolve(data);
});
return def.promise();
}
}),
series: {
title: 'Displays Product Costs for items in our Database',
argumentType: String,
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'
}
}
})
HTML
<script type="text/javascript" src="~/Scripts/angular.js"></script>
<script type="text/javascript" src="~/Scripts/angular-sanitize.js"></script>
<script type="text/javascript" src="~/Scripts/globalize/globalize.js"></script>
<script type="text/javascript" src="~/Scripts/dx.chartjs.js"></script>
@Scripts.Render("~/Scripts/ChartDesign.js")
<div ng-app="customCharts">
<div ng-controller="ChartController">
<div dx-chart="productSettings"></div>
</div>
</div>
您仍然在此處調用'localhost'而不是'http:// dashboardexample.cloudapp.net':'url:'http:// localhost:53640/Home/PostChart''。 – 2015-03-31 18:12:20
好的,一秒鐘,我會測試它。 – Tim 2015-03-31 18:15:47
嗯,由於某種原因,仍然沒有數據。我想知道它是否與Windows Azure中的權限有關,無法傳入我的Json對象... – Tim 2015-03-31 18:20:49