Add, remove shoppingcart services

Tried to connect two pages ‘product.hbs’ where people could add items to shopping cart and ‘checkout.hbs’ where added items should be shown. Anyone here who knows how to get this done.

//services/product.js import Service from ‘@ember/service’;

export default Service.extend({ products: [],

init() {
	this.set('products', []);
add(product) {
remove(product) {
empty() {



I am Product


{{#each model as | product|}}





<button {{action "add" product}}>Add</button>



import Ember from ‘ember’; const { service } = Ember.inject;

export default Ember.Controller.extend({
appName: “ShoppingCart”, products: [], actions: { add(product) { this.get(‘products’).pushObject(product); } } });


import Component from ‘@ember/component’; import Ember from ‘ember’; import { inject as service } from ‘@ember/service’;

export default Ember. Component.extend({ cart: Ember.inject.service(‘checkout’),

actions: {
	remove(index) {



I am Checkout


    {{#each cart.products as |product index| }} X
  • {{product.title}}
  • {{product.owner}}
  • {{}}
  • {{product.price}}
  • {{/each}}

I dont know the answer to your question but I expect it would help others to answer if you could improve the formatting of your code and state what problems you are experiencing (error messages etc?) with your current code.