title: Async call for computed property - Vue.js
body: <p>I have a computed property that will only be used if a match for a property exists. Because of this, I'm making the call to get the data <code>asynchronous</code> so that it's only retrieved when needed. I'm having an issue though trying to make an <code>async</code> call to return data for a computed property.</p>
  
  <p>Below is what I have:</p>
  
  <pre><code>new Vue({
      el: "#formCompleteContainer",
      data: {
          form: {},
          components: []
      },
      computed: {
          employeeList: function () {
              var self = this;
              if (_.some(this.components, function (component) {
                  return component.ComponentInfo.Type === 8
              })) {
                  var employees = [];
                  $.ajax({
                      url: "/Form/GetAllUsers",
                      type: "GET"
                  }).done(function (results) {
                      employees = results;
                  });
  
                  return employees;
              } else {
                  return [];
              }
          }
      }
  });
  </code></pre>
  
  <p>I know this isn't working because I'm returning before the call is complete. I've seen how to use <code>deferred</code>objects and what not but I can't seem to figure out how to implement it with <code>Vue</code>.</p>