Access a Template's Instance scope and inject data
<p>I am looking for a way to access and inject some data into a Template's variable. I want to fetch the data on before route and have it already available when the needed Template renders.</p>

<p>Having a direct access to that scope would be useful. This is my code for that specific template (that is not rendered yet), the variable is <strong>allFriends</strong></p>

<pre><code>Template.FacebookLook.onRendered(function () {
  const instance = Template.instance();

  if(!!Friends.find().fetch()) {
    instance.allFriends = Friends.find().fetch();
  } else {
    Popup.show("Invite your friends", null);
  }

});
</code></pre>

<p>I found some discussions on the forums and I got as far as:</p>

<pre><code>Template.InitView.onCreated(function () {
  Blaze.getView('FacebookLook').allFriends.set([]);
});
</code></pre>

<p>But I get a <code>Uncaught Error: There is no current view</code></p>