0
如何訪問角JS成功響應$範圍可變另一個功能
$scope.mydoc = function() {
var params = {
tribe_id: $scope.parentCtrl.id
};
dealRoomApiService.getOfflineLoanDocs(params)
.then(function(resp) {
$scope.docList = resp.data;
}, function(error) {
toastr.error(error.data.detail); //Show a toast notification
});
}
在上面的函數$scope.docList
我想要訪問以下功能的另一
$scope.myDoc = function(doc, index) {
console.log("Test....",$scope.docList);
};
這將可用。當前代碼 – Nitheesh
@Nitheesh,Notice'dealRoomApiService.getOfflineLoanDocs'必須是異步 – Satpal
$ scope在控制器中的任何地方都可用,所以您應該可以訪問它,但是,如果您需要將其傳遞到另一條路徑改用$ rootScope。 –