angular-ui / AngularJS-StyleGuide

Example of scalable architecture for my NG-Conf 2014 talk
http://www.youtube.com/watch?v=Iw-3qgG_ipU
284 stars 53 forks source link

new JobObject() upStream/downStream #10

Closed marcfallows closed 10 years ago

marcfallows commented 10 years ago

Would we be expecting to pass the AppObject's upStream/downStream in the constructor here: https://github.com/ProLoser/AngularJS-ORM/blob/master/modules/Project/Project.coffee#L20

I would expect this to be:

new ProjectObject(AppObject.upStream, AppObject.downStream)

But then, I'm not sure how that would work further down the chain (say, a separate route for a new task form). How would you have the right project instance to get the upStream/downStream?

ProLoser commented 10 years ago

We didn't need to in our project because as soon as you did formObject.save() we threw the object away and let the socket event spin up an equivalent instance in cache that was properly wired into the event system.

However you do have a point that you need the query stream to even call .save()

You could instead of injecting the class inject the parent object and create a new method called appObject.newProject(initData) or something. This may be a better approach anyway.