Open Jesus82 opened 7 years ago
Hi! For total items I used: ngCart.getTotalItems() and for total cost just called: ngCart.totalCost() | currency
Another way could be: var cart_items = ngCart.getCart().items; var total = ngCart.getCart().totalCost;
Hope this helps!
Hi, thanks for your reply. I have also used those functions when I'm inside the ng directive (for example, in the cart.html or checkout html files). The point is that I would like to use it also from outside the directive (that is, from my controller's view, but outside the parts injected by <ng-cart></ng-cart>
or <ng-checkout></ng-checkout>
Did you manage to do that with the ngCart object? I don't seem to be able to access the object outside the directive, but maybe I'm doing something wrong...
Hi, I would need to access
ngCart.getTotalItems()
andngCart.totalCost()
functions from my controller's view (in order to display some items conditionally based on the number of items added to the cart and the total cost of it). What would be the way to correctly accessing those functions? Should I create a service/factory for it?Thanks in advance