I have a Vars
binding statement, like so
val data: Vars[Contact] = Vars.empty[Contact]
I'm trying to show the number of elements like so:
<div>{data.all.bind.size}</div>
But this produces a complication error
type mismatch;
[error] found : com.thoughtworks.binding.Binding[App.this.data.All[App.this.Contact]]
[error] (which expands to) com.thoughtworks.binding.Binding[scala.collection.mutable.Buffer[_ <: App.this.Contact]]
[error] required: com.thoughtworks.binding.Binding[scala.collection.mutable.Buffer[_$6]] where type _$6 <: App.this.Contact
[error] {this.data.all.bind.size}</div>
How to make this work?
trying to use String
as type for Vars
binding, same outcome
type mismatch;
[error] found : com.thoughtworks.binding.Binding[App.this.data.All[String]]
[error] (which expands to) com.thoughtworks.binding.Binding[scala.collection.mutable.Buffer[_ <: String]]
[error] required: com.thoughtworks.binding.Binding[scala.collection.mutable.Buffer[_$6]] where type _$6 <: String
[error] {this.data.all.bind.size}</div>
Note that i'm using Scala.js 1.2, Scala 2.13.3 and
libraryDependencies += "org.lrng.binding" %%% "html" % "latest.release"
unfortunately, can't provide scalafiddle since it doesn't support Scala 2.13, instead I created a replica project here-
https://www.dropbox.com/s/i9dpsa9pz0lejtj/bindingreplica.tar.gz?dl=0
You can use length
for this.
<div>{data.length.bind.toString}</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With