看来你只是将错误的参数传递给dataSource字段。经过一些玩弄你的羽毛球,
的
而不是传递一个执行$ http调用的函数,我传递了数据本身
</强>
,如下所示。
var myApp = angular.module(“myApp”, []);
//The below code will read the data from student.json file and will pass to the $scope variable
myApp.controller(“ParentCtrl”, function($scope, $http) {
$http.get(‘./chart.json’) //reading the studentRecord.json file
.success(function(data1) {
$scope.dataSource = data1; // binding the data to the $scope variable
FusionCharts.ready(function() {
//alert("1");
var conversionChart = new FusionCharts({
type: 'funnel',
renderAt: 'chart-container',
width: "100%",
dataFormat: 'json',
dataSource: $scope.dataSource
});
conversionChart.render();
});
});
});
</code>
注意我将代码包装在$ http的成功回调中,这样我们就知道数据在渲染时就存在了。
你可以看到工作的plunker
这里
。