“Duplicates in a repeater are not allowed” on ng-repeat

前端 未结 6 1976
野的像风
野的像风 2021-02-05 06:48

I\'ve got the following json data returned from a service request:

{
    \"entries\": [{
        \"id\": 2081,
        \"name\": \"BM\",
        \"niceName\": \"         


        
6条回答
  •  北海茫月
    2021-02-05 07:32

    Your JSON is invalid and should be :

    {
        "entries": [{
            "id": 2081,
            "name": "BM",
            "niceName": "bodmas"
        }, {
            "id": 8029,
            "name": "Mas",
            "niceName": "Masm"
        }],
        "count": 2
    }
    

    Also, make sure you are accessing the document at the right level, use :

    $http.get('https://myServiceURL').success(function(data){
        $scope.entries = data.entries;
    });
    

    Then, it should work. See this JSBin.

提交回复
热议问题