A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://stackoverflow.com/questions/64103296/binding-scala-how-to-get-updating-count-from-vars below:

Binding.scala - how to get updating count from Vars

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?

Update

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


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4