0

I'm repeating the contents of a array using ng-repeat with Angular. After that, but in the same table, I want to add some extra rows with info. But because it is in the ng-repeat I get an angular error on {{getCartTotal()}}, which is now called infinite times.

Is there a way to stop the ng-repeat, or a other way to add extra rows after a ng-repeat in the same element?

This is the code I have (in Jade). Only the first tr must been repeating.

table.shop_table.woocommerce-checkout-review-order-table
   tbody
       tr(ng-repeat='product in shoppingCart')
          th 
             {{product.name}}
             span.count  x {{product.quantity}}
             td
                span.amount € {{product.price * product.quantity | number:2}}
       tr.cart-subtotal(ng-repeat-end)
         th Subtotaal
           td
             span.amount € {{getCartTotal()}}}
       tr.shipping
         th Verzendkosten
           td
            span 
              i 
                | Tijdelijk gratis!
        tr.order-total
          th
            strong Totaal
               td
                strong
                   span.amount € {{getCartTotal())}}
3
  • You have an extra '}' behind getCartTotal() Commented Oct 3, 2016 at 14:16
  • 1
    ng-repeat-end used with ng-repeat-start and will be repeated too. Try to delete ng-repeat-end Commented Oct 3, 2016 at 14:19
  • @AlexanderAnikeev thank you! a 'simple' repeat is enough here! Commented Oct 3, 2016 at 14:27

1 Answer 1

2

Duplicate from comment.

ng-repeat-end used with ng-repeat-start and will be repeated too. Try to delete ng-repeat-end

tr(ng-repeat='product in shoppingCart')
    th 
        {{product.name}}
        span.count  x {{product.quantity}}
        td
          span.amount € {{product.price * product.quantity | number:2}}
tr.cart-subtotal
    th Subtotaal
        td
            span.amount € {{getCartTotal()}}
Sign up to request clarification or add additional context in comments.

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.