0
私はバックエンドとしてParse.comを使用しています。まず、_User
クラスとcustomer
クラスの2回投稿を送信する必要があります。 Customer
クラスは_User.objectId
へのポインタuser_id
フィールドを持っています。最初の応答のAngularJS変数は2番目の要求に渡されませんか?
私は_User
に投稿を送り、objectIdを取得し、_User
objectIdを含むcustomer
に投稿を送信します。ここで
は私のコード
$http.post('http://128.199.249.xxx:1337/parse/users', data, configRegister).then(function (response) {
console.log(response);
$scope.userObjectId = response.data.objectId;
console.log($scope.userObjectId); //succes print objectId
}, function (error) {
alert(error.data.error);
});
var dataProfileCustomer = {
user_id : {
__type: "Pointer",
className: "_User",
objectId: $scope.userObjectId //this part is not exist when I check in post request
},
family_name: $scope.customer.family_name,
family_phone: $scope.customer.family_phone,
family_address: $scope.customer.family_address
};
$http.post('http://128.199.249.xxx:1337/parse/classes/customer', dataProfileCustomer, configRegister).then(function (response) {
console.log(response.data);
}, function (error) {
alert(error.data.error);
});
上記のコードの結果が正常customer.user_id
が定義されていない、2クラスに挿入しています。
コードに何か不足または間違いがありますか?
最初のhttp.post要求の成功応答内に2番目のhttp.post要求コードを書き込む必要があります。 –