title: AngularJS. Can see variable in console.log but cant use it
body: <p>I've requested to the server by $resourse.query method and got data response.</p>
  
  <pre><code>habitantsResource.query(
          {
              $filter: "startswith(Email, '" + vm.email + "')",
          },
          function (data) {
              vm.habitantId = data[0].habitantId;
              console.log(data[0].habitantId)
          });
  </code></pre>
  
  <p>value appears at console</p>
  
  <p>but vm.habitantId stayed empty.</p>
  
  <p>How to get this value?</p>