One of the main advantages of developing on open source technology is that we don't have to reinvent the wheel with every feature. We first look if there's any module that already does what we want to accomplish, before we start it ourselves, from scratch. That's true in the case of the shopping cart; we are going to use the already available module: ngCart.
The ngCart module provides the following directives and services that we need to get started with the shopping cart:
It renders an Add to cart button:
<ngcart-addtocart id="{{item.id}}" name="{{item.name}}" price="{{item.price}}"></ngcart-addtocart>
.Renders a shopping cart:
<ngcart-cart></ngcart-cart>
.Shows the cart summary:
<ngcart-summary></ngcart-summary>
.Renders the checkout buttons for PayPal and other HTTP services:
<ngcart-checkout service="http" settings="{url:'/checkout' }"></ngcart-checkout>
.