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";
</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";
}
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.