为什么不在AngularJS中输入数组给出结果

时间:2015-01-06 13:04:27

标签: javascript angularjs

我正在使用此代码来使用AngularJS获取结果

<div ng-repeat="item in CartItems" class="row">
    <input type="hidden" ng-init="cart.premium[$index] = item.bid_amount" ng-model="cart.premium[$index]">
</div>

在控制器中

app.controller('ShoppingCart', function($scope, MenuData, $rootScope, $http, RouteData, MyCache) {
           $scope.route =   RouteData.url;
            $scope.user_detail = $rootScope;
            var total = 0;

            // Cached data
            $scope.msg = 1;
            $scope.CartItems = MyCache.get('CartItems');
            $scope.total = MyCache.get('total');
            $scope.itemsCount = MyCache.get('itemsCount');

            // data is not in cache then get from server
            if(!$scope.CartItems) {

               
            };
      
      $scope.cart = {};
           
            $scope.check_out    =   function(){
               
                if($scope.cart.total <= 9999){
                    alert($.param($scope.cart));

                    PayPalMobile.renderSinglePaymentUI($scope.createPayment1($scope.cart.total), $scope.onSuccesfulPayment, $scope.onUserCanceled);

                }

            };

但它无法给出任何结果。当我们做的时候

 <input type="hidden" name="test[]" value="test">

给出所需的结果。

如何使用AngularJS实现这一目标?

0 个答案:

没有答案