3

I am building an admin panel that involves mostly CRUD operations in AngularJS. I have seen many examples of how to do this on the web. Each example I have seen is a single page application that handles a single type (for example Person, Employee, etc.).

My question is the following: If the admin application I am building will involve a large number of CRUDS (one for each type used in the database), should I still use one single page app for the entire admin panel website or should I make each CRUD a separate single page application?

What is the best practice for this?

stepanian
  • 11,373
  • 8
  • 43
  • 63
  • There is a blog entry on http://blog.angularjs.org/ with some guidelines on best practices (down at Feb 13th). Personally I have found a single page app, with views for each "page" the best approach, but haven't done what might be described as a large application yet. – Lee Willis Aug 01 '14 at 08:16
  • @LeeWillis Thanks. It's funny, even in that document, the folder structure patterns are for one app each and they are all simple apps (with two or three views). The question is, are each of these an example of multiple apps that would be combined into a website or the app itself would be expanded with more views? – stepanian Aug 01 '14 at 08:23

2 Answers2

7

We've chosen to use a single app for a multi-model admin GUI built with angular.js called ng-admin (open-source, see code at https://github.com/marmelab/ng-admin).

It works very well, and it's easier to deal with model relationships (one-to-many, many-to-one, many-to-many). Doing so with several apps would imply booting several applications - probably bad for webperf.

François Zaninotto
  • 7,068
  • 2
  • 35
  • 56
0

Angular is really good for CRUD operations. There are many large scale apps with lots of CRUD operations that have used angular. Go to built with angular and see the apps. You can find the source code as well.

Generally, rest services are used to make CRUD apps.

In my opinion, making each CRUD a separate app would not bring out the best performance of a SPA as some contents like the header and footer do not change much, so it would not be feasible to render them multiple times.

adib.mosharrof
  • 1,624
  • 1
  • 12
  • 16
  • So are you saying that most of these large applications are built as one SPA with a large number of routes and views? – stepanian Aug 01 '14 at 08:32
  • Also, does this mean that, in my example, the JavaScript file for all of the CRUD operations and all the other logic would be combined into one big file and downloaded initially with the single index.html page? – stepanian Aug 01 '14 at 08:47
  • This is part of the build process for an angular app. Concatenating it into a single file is a common practice. You could also use requireJs. I would suggest you to search related questions about including javascript files in angular js apps http://stackoverflow.com/questions/20633995/angularjs-app-how-to-include-js-files-into-index-html http://stackoverflow.com/questions/15939913/single-page-application-load-js-file-dynamically-based-on-partial-view – adib.mosharrof Aug 01 '14 at 10:15