title: Module circular dependency due to using the same resource
body: <p>I'm using parse.com as my backend. I have 2 tables: post and comment. A post have multiple comments, so it is a one to many relationship. so I have comment point to the post (which is easy) but also an array on post that list all the comments this post have. I imagine if I used MongoDB or any other NoSQL it will be the same.</p>
  
  <p>On front end, I have 2 modules: "post" and "comment". Each have a resource that is hooked with the backend. Each module also have all the CRUD pages that create, read, update and delete. When I write the view part, a post need to display all the comments below, so my post module depends on comment module and will use comment resource to find all comments for this post.</p>
  
  <p>But when I write the create part for comment, I found myself need to update the post array and add the newly created comment to the array. Which means I need the post resource to update the post. The post resource is in the post module so now my comment module depends on post module and created a circular dependency.</p>
  
  <p>I have 2 solutions I'm going to share, but I want to know if anyone have anything better:</p>
  
  <ol>
  <li><p>I use angular-ui-router in my project. After a comment is created, I route back to a post state called "app.post.commentCreated" . This state is handled inside the post module. It will update the post array of comments.</p></li>
  <li><p>I separate the post resource and comment resource to their own module called "postResource" and "commentResource" and make post and comment module depends on both. I have not done this yet. I'm about to.</p></li>
  </ol>
  
  <p>Do you have anything better?</p>
  
  <p>Thank you very much!</p>