In Scala and Python it's:
z.put("varname", variable)
But in javascript I get (in the console)
Uncaught ReferenceError: z is not defined
What I really want to do is access a javascript variable from Scala code using z.angular("varname")
in Zeppelin, but I'm having no luck :(
In full need in one cell 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 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.
Cell 1:
z.angularBind("myVar", "myVar")
z.angularBind("msg", "msg")
Note I have no idea what to put in 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 either get null
or the var name.
I don't see a button either or anything to "click".