Search for instructions on how to structure a one-page application

We are a team of developers who have been programming web applications for several years. Now we start with a new project, and we strive to make it one-page. For the front, we use angular. We are relatively familiar with angular, we know how to create services, directives, controllers, etc. We know how to use built-in services such as $http and $resource and as user routes (or states with ui-router ), but we are stuck in a rather early state on how to structure the application.

It’s hard for us to find good resources (blogs, videos, books) that deal with this common problem. Many posts have a very simple approach, for example:

"To build a SPA, you need to use $http , so you do it, right?"

They can be very good to understand the basics of each component, but they do not explain that it is necessary to combine all this together. The questions we have are of the following type:

  • Do we create a central js object view of the application state? If the application becomes the other side of the online store, then the central object is likely to be a company that has a list of products, each of which has a list of orders, and each of them has a link to a customer. Or do we share a representation of the state of the application in different objects? If so, how do we keep them in sync?

  • To display the form that edits the entity, we create a route that loads the partial view into the view, and we populate the area with the entity for editing. Are we getting an object from the back? Or, if we already have it in our js model, we just get it from there so that we do not need to make an HTTP request?

There is still a lot that is incomprehensible, and I understand that there will not be a simple answer to any question, rather, these are most likely different design templates with pluses and minuses. I do not expect answers to all my questions in response to this post, but I would like to find some resource (for example, I said a blog, video, book) that discuss these problems at the application level. Some angular issues are specific, and some are more general for single page applications. Do such resources exist?

+4
source share
1 answer

I'm relatively new to AngularJS, and I agree that finding information that goes beyond the basics is difficult. So far, the most useful lessons I have found are Dan Wahlin.

The 60-minute tutorial was great and its other material is good for getting you past the Hello World scene. I also watch a couple of presentations from Misko Hevery, creator of Angular, and he is also very good.

+3
source

Source: https://habr.com/ru/post/1485751/


All Articles