Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 将多维对象中的数据填充到ng重复列表中_Angularjs_Ionic Framework - Fatal编程技术网

Angularjs 将多维对象中的数据填充到ng重复列表中

Angularjs 将多维对象中的数据填充到ng重复列表中,angularjs,ionic-framework,Angularjs,Ionic Framework,我从ionic应用程序中的数据库中获取以下数据。我正在将其保存到$scope.dbCustomersArray: [ { "customer_id":1, "customer_name":"Test Company", "customer_address":"17 Morena Blvd Camarillo", "customer_city":"Ventura", "customer_contactnumber":"80

我从ionic应用程序中的数据库中获取以下数据。我正在将其保存到$scope.dbCustomersArray:

 [  
   {  
      "customer_id":1,
      "customer_name":"Test Company",
      "customer_address":"17 Morena Blvd Camarillo",
      "customer_city":"Ventura",
      "customer_contactnumber":"805-832-6163",
      "Company_id":1
   },
   {  
      "customer_id":2,
      "customer_name":"Another test company",
      "customer_address":"2742 Distribution Way Metairie",
      "customer_city":"Jefferson",
      "customer_contactnumber":"504-979-9175",
      "Company_id":1
   },
   {  
      "customer_id":3,
      "customer_name":"Final test company",
      "customer_address":"775 W 17th St San Antonio",
      "customer_city":"Bexar",
      "customer_contactnumber":"210-812-9597",
      "Company_id":1
   }
]
我试图在html中循环使用它

<label class="item item-input" style="padding: 0px">
                <div class="row">
                <label class="item item-input item-select col">
                    <div class="input-label" style="visibility: hidden">
                        Customer
                    </div>
                    <select>
                        <option> -- Customer -- </option>

                        <ion-item ng-repeat="customer in $scope.dbCustomersArray">
                           <option> Hello, {{customer.customer_name}}! </option>
                        </ion-item>

                    </select>

                </label>
                </div>
            </label>
请帮我解决这个问题。我看不出我错在哪里。先谢谢你

编辑


当我点击客户选择列表时,我无法在我的ionic应用程序中看到数组中的值。

看起来您有两个问题:

  • 您不应该在HTML中使用$scope。在ng repeat中仅放置dbCustomerArray
  • 我没有看到你的HTML中加载了你的控制器。您需要ng控制器,以便它知道从何处加载$scope数据
  • 在对象数组中循环时,0、1、2听起来很精确,因为它们是数组索引。我认为确认您的控制器已加载并删除$scope将纠正您的问题


    关于,

    从中删除$scope:。这不是一个正确的答案syntax@MichaelZucchetta我这样做了,并试图再次运行该应用程序。在我的应用程序中,数组中没有可见的值。请等待答复。我自己也看了一眼,但结果不起作用。使用
    时,值显示良好,但上面的代码不会显示任何值。
    for (var customer in $scope.dbCustomersArray) {
         console.log("LOGGING A CUSTOMER - " + customer.customer_name);
    }