I have the following problem:
app.controller('EOGController', ['$scope', function($scope) {
$scope.result = "primero";
angular.element(document).ready(function () {
loadQuantiles();
});
var loadQuantiles = function () {
console.log("entro");
$scope.result = "ultimo";
console.log("salio");
}
}]);
index.html
<div class="container" ng-controller="EOGController">
{{result}} <!-- <- cuyo valor siempre es primero -->
</div>
Why don't you change
PS: the console.logs()
if they come out correctly in the console
What happens is that you are interrupting the life cycle of the functions in AngularJS, when using the ready event, so you should not use it that way. At the moment that AngularJS executes the controller it is because you can already work with the DOM, in case you need something like this, simply call the function:
to tell AngularJS that the variables above the $scope have changes, just be aware that it's not the right way. Example running in codepen