Doubt - Angular Controllers

4

I'm studying Angular and I had a question. I'm creating an application, and I wanted to organize the controllers by creating one for each View (template).

Exemplo:
Tela Cadastro - controller-cadastro.js
Tela Login - controller-cadastro.js
Tela Vídeos - controller-videos.js

Can I create a controller for each view? Is this logic correct? Is there a more intelligent and common way for a controller to control a different view and keep the structure of the files divided?     

asked by anonymous 30.11.2016 / 12:48

1 answer

3

You can have Controller per view , but the important thing is to recognize that the Controller concept serves to separate application scopes. Controller decouples the format of the presentation data. For example, you may have client data but you do not want to show all of them in certain view .

Taking advantage of your doubt and noting that you are interested in how best to program using AngularJS, a good practice material that is Angular Style Guide .

    
30.11.2016 / 13:00