Good morning,
I am doing this procedure and I have a question, I am passing a series of paramentos to a service, that in the modification I modify those variables that go by parameter, then when entering in the controller, I do not see the changes, eye this happens nothing else with variables that are not an array, I leave the code:
Controller:
gridService.potitionInitial($scope.grids, $scope.posXAct, $scope.posYAct);
Service:
this.potitionInitial = function (grid, posXAct, posYAct) {
posXAct = Math.floor(Math.random()*10);
posYAct = Math.floor(Math.random()*10);
grid[posXAct][posYAct].active = true;
}
The $ scope.grid if it is modified, but the $ scope.posXAct and $ scope.byYAct no, I do not really understand why the arrays are passed by reference and the normal variables do not, please help me, I urgently need to solve this.
Greetings