I have a huge controller, I have split it into subcontrollers, which I put into other files according to their functionality.
Everything works fine, but I need an advice and the answer on my question: have I done it right?
here is a huge controller:
function controller($scope, $http) {
//code
someFunction($scope, boolA, function1, function2);
//code
}
here is the code of my subcontroller in other file, which I load after the front controller:
function someFunction($scope, boolA, function1, function2) {
//code where I use all the parametrs of function
function someFunctionSubcontoller() {
//here is used another function from other subcontroller
}
}
Is it ok to send functions as parametrs? Is it okay whether I don't return anything from subcontrollers, because $scope watches everything? Is it okay whether I use some functions of contoller in another one?
Now I see that's not good and not right, but I need to split main contoller because there are more than 10k rows of code in it.
thanks for your advice and help !!!