Javascript 在连续多次调用控制器后,PROMITE.then被取消,只有last返回数据
我的问题是,我需要控制器的三个独立实例,我从html调用它 我的控制器是这样的Javascript 在连续多次调用控制器后,PROMITE.then被取消,只有last返回数据,javascript,angularjs,angularjs-directive,Javascript,Angularjs,Angularjs Directive,我的问题是,我需要控制器的三个独立实例,我从html调用它 我的控制器是这样的 app.controller("overallCtrlDemo", function($scope,$rootScope,overAllService,lookupService,uiGmapGoogleMapApi) { var promise=overAllService.getOverAll(); promise.then(function(data){ $scope.t
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中有三个指令
<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>
a角度控制器总是调用一次。也许你需要一个指令?看我的编辑,还有一些其他问题,
console.log
来自哪里?我把console.log(promise)放在控制器中