0
我尋找簡單的join()
爲線程,但爲角。與角度syncronize事件(如線程'join()'函數)
在我的控制器:
vehiclesService.getVehicles().then(function(sth){
$scope.vehicles = sth.data;
$scope.isend();//this call suck in my mind
});
vehiclesService.getFitment().then(function(sth){
$scope.fitment = sth.data;
$scope.isend();//this call suck in my mind
});
vehiclesService.getTagsList().then(function(sth){
$scope.tags = sth.data;
$scope.isend();//this call suck in my mind
});
我想的東西調用函數時,所有的3個變量被初始化。目前的工作。但在我心中,這是令人傷心的。我也嘗試
$scope.$watch('vehicles', function() {
$scope.isend();
});
$scope.$watch('fitment', function() {
$scope.isend();
});
$scope.$watch('tags', function() {
$scope.isend();
});
$scope.isend = function(){
if($scope.vehicles !== undefined && $scope.fitment !== undefined && $scope.tags !== undefined)
alert('doSomething');
}
它的工作,但我發現它甚至最差!
什麼是在角度做這樣做的好方法?
ty for編輯,當前正在做:)。儘快接受! – ssbb