Jaypi Jaypi - 1 year ago 89
AngularJS Question

AngularJS - Move Object from Controller 1 to Controller 2

I'm currently learning AngularJS but I wasn't able to find a solution for this problem even though it seems trivial.

I have two lists / controllers that are getting created by factory service.

I want to remove an object from list 1 and add to list 2. When I display the object in the console after passing it, I can see it but it doesn't appear in my second list.

I have the code on GitHub - As you can see this is an assignment from coursera.

Answer Source

I am not sure I am answering your question, but I have created a plunker based on your github code:

I see only one list of items in the code:

  name: "Milk",
  quantity: "10"
}, {
  name: "Donuts",
  quantity: "10"
}, {
  name: "Cookies",
  quantity: "10"
}, {
  name: "Chocolate",
  quantity: "10"
}, {
  name: "Apples",
  quantity: "10"

And it seems like the ui behaves as expected.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download