I am doing a visualization using D3 on zeppelin and I need to link Scala variable with javascript one.
In a simple way, I have the following three paragraphs:
1)
z.angularUnbind("aux")
z.angularBind("aux", "original value")
2)
%angular
<button onclick="myFunction()">Click me</button>
<p id="demo"></p>
<script>
function myFunction() {
if (document.getElementById("demo").innerHTML === ""){
document.getElementById("demo").innerHTML = "Hello World";
aux = "If"
}else{
document.getElementById("demo").innerHTML = "";
aux = "Else"
}
}
</script>
3)
z.angular("aux")
And I hope the following results:
Before click on "Click me" button I hope: aux = "original value".
After one click on "Click me" button I hope: aux = "If"
After two click on "Click me" button I hope: aux = "Else"
How to link javascript "aux" variable with angular's "aux"?