How to put a variable in z ZeppelinContext in javascript in Zeppelin?

In Scala and Python, these are:

z.put("varname", variable)

But in javascript I get (in console)

Uncaught ReferenceError: z is not defined

I really want to access the javascript variable from Scala code using z.angular("varname")in Zeppelin, but I'm out of luck :(

Fully needed in one cell is something like

%angular
<script>
var myVar = "hello world";

// some magic code here!
</script>

Then in another cell

println(z.angular("myVar"))

UPDATE:

This is what I still have, I completely beat in the dark, since I'm more a guy. Therefore, I apologize in advance for the hopelessness of my front.

Cell 1:

z.angularBind("myVar", "myVar")
z.angularBind("msg", "msg")

Note. I have no idea what to add to the second argument.

Cell 2:

%angular

<div ng-app>
    <div id="outer" ng-controller="MsgCtrl">
        You are {{msg}}
    </div>
    <div onclick="change()">click me</div>
</div>

<script>
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';
    })
}
</script>

Cell 3:

z.angular("msg")
z.angular("myVar")

And no matter what I do, I just get nullor the name var.

I don’t see anything in the "click" button.

+5
2

Angular.

  • html

    {{name}}

  • ng-model='name'

  • ng-click Angular.

    ng-click="name='Rockie'"

Angular ​​ SO. . js, .

Spark-.

  • z.angularBind("name", "Knock Data")

  • z.angularUnbind("name")

  • , , null.

    z.angular("name")

  • z.angularWatch("name", (oldValue: Object, newValue: Object) => { println(s"value changed from $oldValue to $newValue" })

Angular bind. -

  • z.input("number", 1).toString.toInt

  • z.select("Day", Seq(("1", "Mon"), ("2", "Tue")))

  • ,

    z.select("Day", "1", Seq(("1", "Mon"), ("2", "Tue")))

  • z.checkbox("good applications", Seq(("1", "Zeppelin"), ("2", "Highcharts"), ("3", "Spark")))

+7

% Angular

<div id="map" style="height: 300px; width: 50%" ng-model="id_selected_arr"/>

% spark2

var result = z.angular("id_selected_arr")

, ... , - , .

0

All Articles