私はangularjsを初めて使いました。私は別の関数から関数のスコープ変数にアクセスするのに問題があります。別の関数から関数のスコープ変数にアクセスする
第一機能
$scope.getCustomer = function (customer_id) {
ABCServices.wts.customer.customerList({customerId:customer_id}).then(function (data) {
console.log("^^^^^ABC show^^^^^");
$scope.wtsdata = data;
console.log($scope.wtsdata);
});
};
だからここに私は私の第二の機能で$scope.wtsdata
にアクセスしたいです。私はそれにアクセスしようとすると、私に未定義のエラーが発生します。これを行うには?
第二の機能
$scope.selectCustomer = function (item) {
$scope.item = item;
if (item.length === 8) {
$scope.getCustomer(item);
console.log("Check"+$scope.wtsdata);
}
};
両方の機能が同じコントローラ内にあるか、または異なっていますか? – Rakeschand
@Rakeschand同じコントローラ –