I need to retrieve xml data from local file.
With this simple code:
angular.module('exampleApp', [])
.controller('ExampleController', function($scope, $http) {
    var turniOra = this;
    $http.get("/XmlTemp/turni_giorno.xml",
        {
            transformResponse: function (cnv) {
                var x2js = new X2JS();
                var aftCnv = x2js.xml_str2json(cnv);
                return aftCnv;
            }
        })
        .then(
            function(datiConve){
                turniOra.prova = datiConve.data.turni.giornata;
            }
        );
    console.log(turniOra.prova); // undefined
});
The console log return "undefined", but with a $timeout directive:
$timeout(function() {
    console.log(turniOra.prova);
}, 50);
I have the correct object with xml data.
Why this happen, and how can I get the same result without $timeout?
Thanks
 
    