I want to use Binding.scala in my Github Pages.
The Problem I have is that the value that I bind
is not updated.
Here the example:
val radiusVar = Var(3.0)
@dom
private lazy val plotly: Binding[HTMLElement] = {
val radiusVal = radiusVar.bind
println(s"new radius: $radiusVal") // this part is not executed after updating the radiusVar
<div class="ui form">
<div class="field">
<label>Radius</label>
<input type="text" name="radius" id="radius" value={
radiusVal.toString
}/>
</div>
<button class="ui button"
onclick={
_: Event =>
println("radius.value: " + radius.value) // this works
radiusVar.value = radius.value.toInt
}>Submit</button>
</div>
}
Whenever changing the radius, I expect that println(s"new radius: $radiusVal")
is executed.
It works in ScalaFiddle from Yang Bo: https://scalafiddle.io/sf/PET64Sz/1
The rendered Page: Github Pages
The whole project: Github
The problem was that I included the ..-fastopt-bundle.js
more than ones.
It looks like the second action was called on the other "JavaScript".