E
E
Eka22016-07-13 01:18:33
Angular
Eka2, 2016-07-13 01:18:33

How to properly organize the use of the controller?

There are two pages - on one the list of elements is simply displayed, on the second - the list of elements is displayed in the admin panel and editing operations are performed. CRUD operations are performed through the use of the Resource service.
Is c t.z. correct? architecture of the application will make one controller for two views , in the first case only one method will be used - loading data, in the second all 4?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anatoliy Mikhailov, 2016-07-13
@Eka2

From a security point of view, I would rather separate the functional part - a separate user part, a separate admin part (at the module level).
And in the case when both modules use the same functionality (mainly services and directives, they can be entered into some common module + glued through gulp / grunt
If the admin part is used more as an editor functionality, then you can use one controller and one view (based on the role information, you can control the display of the necessary buttons / fields through the ng-if directives)

S
Sergey, 2016-07-13
Protko @Fesor

use components , don't use controllers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question