1

I have table and trying to render out table rows using the ng-repeat.

The situation is that I have a invoice which may or may not have multiple invoice details attached. The data is returned in an object and one of those properties is an array. So, I created my table and used ng-repeat using the array as the model. In a way it works because three table rows are render out but the description remains field blank.

Thanks

I looked here

HTML:

<tbody>
    <tr style="cursor:pointer" ng-repeat="details in vm.orders.componetGrid ">                    
        <td ng-bind="details.componetGrid.componentDescription"></td>
    </tr>
</tbody>

JS

function loadOrder(invoiceNumber) {
    return orderService.getOrderById(invoiceNumber)
        .then(function (result) {
            vm.orders = result.data;                
        }, function (err) {
            console.log("error returned");
        });
}

sample of the dataenter image description here

2
  • 2
    if you don't transform your data in between, details.componetGrid.componentDescription should be details.componentDescription Commented Jun 22, 2016 at 2:26
  • You are already referencing vm.orders.componetGridas your ng-repeat array, you should use details.componentDescription in the iteration. I suggest that you correct the misspelled componetGrid, to componentGrid Commented Jun 22, 2016 at 3:56

3 Answers 3

1

Your reference to componentDescription is wrong. This should work:

<tbody>
    <tr style="cursor:pointer" ng-repeat="details in vm.orders.componetGrid ">                    
        <td ng-bind="details.componentDescription"></td>
    </tr>
</tbody>
Sign up to request clarification or add additional context in comments.

Comments

1

details is binded as each member of the componetGrid, so

                <td ng-bind="details.componetGrid.componentDescription"></td>

should be

                <td ng-bind="details.componentDescription"></td>

instead

1 Comment

I swore at one point I did have that. Developing this in edge and doesnt always clear the cache but soon as I typed this back in worked.
1

From the data you have provided in snippet it looks like componentgrid is a array.

Now in ng-repeat details in vm.orders.componetGrid means details is a componentgrid object.

So you should not say details.componentgrid.componentDescription

instead it should be details.componentDescription

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.