title: Vue directive to access the Vue instance?
body: <p>How do you access the Vue instance from a directive?</p>
  
  <p>I have this HTML</p>
  
  <pre><code>&lt;div id='vueApp' v-init='my initial data from server-side'&gt;
  </code></pre>
  
  <p>and this script</p>
  
  <pre><code>var app = new Vue({
      el: '#vueApp',
      data: {
          myData: null
      }
  });
  
  Vue.directive('init', function(el, binding) {
      app.myData = binding.value;
  });
  </code></pre>
  
  <p>It throws this error:</p>
  
  <blockquote>
    <p>Failed to resolve directive: init </p>
  </blockquote>