ng-repeat没有显示数据....错误(angular.min.js:123错误:[ngRepeat:dupes] http://errors.angularjs.org/1.6.4/ngRepeat/dupes?

时间:2017-06-07 09:09:37

标签: php angularjs-directive angularjs-ng-repeat

我在选项标签中使用ng-repeat来生成多个选项。 但它运作不正常。

//下面是我的Angular js代码

      $http.get("assign_leads_1.php?dummydata=2").then(function (response)
        {
            alert(response.data);
            $scope.bdes = response.data;
        });



Below is the html code
<div class="form-group">
                <label>Assign To: </label> 
<select ng-model="bde_tuid" class="form-control">
                <option  ng-repeat="bde in bdes" value="{{bde.tuid}}" >
                    {{bde.xyz}}
                </option>
            </select>

//下面是从数据库中获取数据的php代码

    require_once 'dbcon.php';      
    $query ="select tuid,username as xyz from tuser where category 
 ='employee'";
    $result=  mysqli_query($link, $query);
    $data = array();
    while($row = mysqli_fetch_array($result))
    {
        $data[]=$row;
    }

    print json_encode($data);
    }

1 个答案:

答案 0 :(得分:0)

更改此行

<option  ng-repeat="bde in bdes" value="{{bde.tuid}}" > 

<option  ng-repeat="bde in bdes track by $index" value="{{bde.tuid}}" >