Passing a promise into ngRepeat

前端 未结 1 840
清酒与你
清酒与你 2021-01-02 08:43

So, I saw an example where they were passing an angualar deferred into ngRepeat and it worked fine. For some reason when I set up this example it doesn\'t work. Can anyone t

相关标签:
1条回答
  • 2021-01-02 09:24

    I don't think you can use the promise objects directly, you should use the then callbacks as stated in the documentation.

    This means that your

    $scope.objects = dataService.getData();
    

    Should instead be something like

    dataService.getData().then(function(data) {
        $scope.objects = data;
    });
    

    Otherwise, your $scope.objects will contain the promise object, and not the data you are passing to resolve.

    See the updated fiddle here.

    0 讨论(0)
提交回复
热议问题