廣播HTTP POST方法的數據我使用相同的HTTP方法在不同的控制器等下面的示例:如何在angularjs
服務:
var method="sampleMethod"
HotalStatisticService.GetReservations = function (data) {
return $http({
method: 'POST',
data: data,
cache: false,
url:'http://sample.com/'+method
});
}
第一控制器
.controller("SampleACtrl", function ($scope,HotalStatisticService) {
HotalStatisticService.GetReservations({start:start, end:end, type:type})
.success(function (data) {
$scope.sampleA=data;
})
}
第二控制器
.controller("SampleBCtrl", function ($scope,HotalStatisticService) {
HotalStatisticService.GetReservations({start:start, end:end, type:type})
.success(function (data) {
$scope.sampleB=data;
})
}
如何在唯一的控制器中使用here方法?
對不起,你能澄清一下你想要的嗎? –
如何在不同的控制器之間傳輸數據,例如廣播,發出 –
這兩個控制器有兩個不同的模塊? –