0
I am creating an angular application where, on the home page I last a controller to do some validations before proceeding with the application login. My question is, do I have to "instantiate" the controllers of each template only when I order that template? I ask this because I do not want to have 1 file controllers with all controllers because it is illogical in the MVC development pattern and not to mention that it delays the application startup. Putting in a draft ("kicking") I think it would be something like:
Template : registration page
<script src="js/controllers/CadastroCtrl.js"></script>
<ion-view view-title="Cadastro" ng-controller="CadastroCtrl">
<ion-content>
<h1>Cadastre alguma coisa</h1>
</ion-content>
</ion-view>
Template : listing page
<script src="js/controllers/ListagemCtrl.js"></script>
<ion-view view-title="Listagem" ng-controller="ListagemCtrl">
<ion-content>
<h1>Liste alguma coisa que foi cadastrada no outro template</h1>
</ion-content>
</ion-view>
Is that right? Does anyone have a better solution to handle the dependencies of each template? I gave the example of the controller but if I also have as dependency some service (Factory) or something of the kind would also fall into this question...
right partner, I had already arrived at this solution of Requirejs and I’m already using it for some time, only I forgot to solve the question rsrs, but thank you.
– LeandroLuk