How to put a variable into z ZeppelinContext in javascript in Zeppelin?
<p>In Scala and Python it's:</p>

<pre><code>z.put("varname", variable)
</code></pre>

<p>But in javascript I get (in the console)</p>

<pre><code>Uncaught ReferenceError: z is not defined
</code></pre>

<p>What I really want to do is access a javascript variable from Scala code using <code>z.angular("varname")</code> in Zeppelin, but I'm having no luck :(</p>

<p>In full need in one cell something like</p>

<pre><code>%angular
&lt;script&gt;
var myVar = "hello world";

// some magic code here!
&lt;/script&gt;
</code></pre>

<p>Then in another cell</p>

<pre><code>println(z.angular("myVar"))
</code></pre>

<p>UPDATE:</p>

<p>This is what I have so far, I'm completely stabbing in the dark, since I'm more of a back end / data science kind of guy. So apologies in advance for my front end hopelessness.</p>

<p>Cell 1:</p>

<pre><code>z.angularBind("myVar", "myVar")
z.angularBind("msg", "msg")
</code></pre>

<p>Note I have no idea what to put in the second argument.</p>

<p>Cell 2:</p>

<pre><code>%angular

&lt;div ng-app&gt;
    &lt;div id="outer" ng-controller="MsgCtrl"&gt;
        You are {{msg}}
    &lt;/div&gt;
    &lt;div onclick="change()"&gt;click me&lt;/div&gt;
&lt;/div&gt;

&lt;script&gt;
var myVar = "hello world";

function MsgCtrl($scope) 
{
    $scope.msg = "foo";
    // also experimented with $scope.msg = myVar;
}

function change() {
    var scope = angular.element($("#outer")).scope();
    scope.$apply(function(){
        scope.msg = 'Superhero';
    })
}
&lt;/script&gt;
</code></pre>

<p>Cell 3:</p>

<pre><code>z.angular("msg")
z.angular("myVar")
</code></pre>

<p>And no matter what I do I just either get <code>null</code> or the var name.</p>

<p>I don't see a button either or anything to "click".</p>