1

The example at http://www.teebow.net/splitting-angularjs-controllers-separate-files/ illustrates a technique for elements like CRUD. Should one use a new controller for every element? Wouldn't this end up with a ton of files like:

updateProductController.js
deleteProductController.js
showProductController.js 

etc. etc.

In Laravel, one can do it like this:

productController@update 

Is using a new controller for every element a normal design pattern?

1
  • Not clear at all what you are asking. You shouldn't need separate controllers for each crud task unless you have different angular routes for each task. Commented Mar 11, 2016 at 13:35

1 Answer 1

2

First: Using controllers helps separate Model / View from Controller logic and it can be argued, is one of the strengths of angular. So yes, using many controllers is, in my opinion, a way of breaking up your logic - neatly.

Second: The way in which you design an angular application is open to preference. But if you are not careful, you can develop anti-patterns which provide the basis for negative coding practices.

Third: You should reference Todd Motto's and John Papa's design and style guide located here and here. Their observations have given a large portion of the angular community best practices and standards for developing angular applications.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.