title: How to Pass Data or values From One Component to another in Angular
body: <p>Good day Community,
  Please i am working on an ecommerce project and i would like to pass the quantity entered in my cart component to my checkout component, and when the value of the quantity changes, i would like it to change in the checkout component also. I have searched for solutions but couldnt find any.
  Someone please assist me.
  Thank you</p>
  <p>This is my cart.component.ts</p>
  <pre><code>  trackByCartItems(index: number, item: any) {
      return item._id;
    }
  
    get cartItems() {
      return this.data.getCart();
    }
  
  
    get cartTotal() {
      let total = 0;
      this.cartItems.forEach((data, index) =&gt; {
        total += data['price'] * this.quantities[index];
      });
      return total;
    }
  
    removeProduct(index, product) {
      this.quantities.splice(index, 1);
      this.data.removeFromCart(product);
    }
  
  
  </code></pre>
  <p>and my cart.component.html</p>
  <pre><code>&lt;div class=&quot;col-1 mt-5 mt-md-0 p-0 induc&quot;&gt;
                  &lt;input type=&quot;number&quot; class=&quot;form-control text-left boy&quot;  [(ngModel)]=&quot;cart.quantities[i]&quot;&gt;
                &lt;/div&gt;
                
  </code></pre>
  <p>Thank you in advance</p>