我的问题是,我想要三个独立的控制器实例,我从html调用它。
我的控制器是这样的
app.controller("overallCtrlDemo", function($scope,$rootScope,overAllService,lookupService,uiGmapGoogleMapApi) {
var promise=overAllService.getOverAll();
promise.then(function(data){
$scope.timeSeries1 = $rootScope.helpers.d3FormatJsonDualAxis(data.data);
$scope.generic = $scope.timeSeries1;
$scope.sunBurst = $rootScope.helpers.d3FormatSunburst(data.data);
})
})
我在html中有三个指令说
但是当html呈现它会调用控制器三次但是 promise.then函数仅返回上次调用的状态1。她是下面的图片
<div id="topProduct-graph" class="chart no-padding" ng-controller="overallCtrlDemo">
<topproducts id = "topProducts" data-role="concentric" data-width=400 data-height=400 data-thickness=13 val=topProducts style="position:absolute;"></topproducts>
</div>
<div class="trendMap" style="width:1213px;" ng-controller="overallCtrlDemo">
<generictimeseries id="genericTimeseries" val="generic" saleorquantity="saleOrQuantity"></generictimeseries>
</div>