0
这个问题是基于this先前的答案。Angular JS - 带有嵌套作用域的http请求时出错
我想送,我想送的要素之一在视图中表示为
{{selectedCountry.shipping[shippingType]}}
请求是为了使一个单一的请求一起等元素去这样一个HTTP请求我
$scope.checkoutData = angular.extend($scope.selectedCountry.shipping[$scope.shippingType], $scope.selectedCountry.name);
混合在一起它们,然后用发送请求
$scope.submitForm = function() {
$http.post('process.php', $scope.checkoutData)
};
但是当做第二步时,我得到一个错误。您可以看到the working fiddle here(第二步注释,所以它不会破坏代码)。提前致谢!
这是失踪,我刚刚修复它:)。但仍然然后当我取消注释表达它仍然给出一个错误http://jsfiddle.net/v3o87L5z/ – Joe82
它看起来像$ scope.selectedCountry.shipping [$ scope.shippingType] evalutes到一个数字是30.你不能扩展数字只是对象... –
更新我的答案修补程序 –