I can't seem to figure out which way to go about this problem:
I got multiple angular controllers, they all need a user-object, which they can manipulate with, and each time it gets manipulated the "new" data needs to be out in the other controllers aswell. At the same time i need to save this user-object in the database for retrievel afterwards (so a auto save function when data is changed on user-object)
But i can't seem to figure out whether i should using a factory or a service to hold this user-object, and how i can get this factory/service to save the user on change via a API.
I read this Sharing ajax data between multiple controllers in angular using service example where he wants to accomplish some of the same things, but the API part and async automatic saving is really giving me trouble!
Bottom line is, i have multiple controllers which needs a user-object from the serverside. And these controllers manipulates with the same user-object, and after each manipulation(maybe with some debounce), i want to save the object to the database via API.
(first of, i thought of watching the object in the service/factory, but found out i couldn't :( )
Can you guys point me in the right direction?