These are chat archives for ThoughtWorksInc/Binding.scala

13th
Jan 2017
Longyang Zhang
@zhanglongyang
Jan 13 2017 21:19
Did anyone encounter this issue before? I’m following the README instructions with the code below, and got error
Uncaught TypeError: Cannot read property 'get__sc_Seq' of null
    at $c_Lcom_thoughtworks_binding_Binding$MapBinding.init___Lcom_thoughtworks_binding_Binding$BindingSeq__F1 (Binding.scala:686)
    at BindingScalaDemo.scala:31
    at $c_sjsr_AnonFunction0.apply__O (AnonFunctions.scala:10)
    at BindingScalaDemo.scala:31
    at $c_sjsr_AnonFunction0.apply__O (AnonFunctions.scala:10)
    at BindingScalaDemo.scala:29
    at $c_sjsr_AnonFunction1.apply__O__O (AnonFunctions.scala:15)
    at Binding.scala:528
    at $c_sjsr_AnonFunction1.apply__O__O (AnonFunctions.scala:15)
    at Binding.scala:518
object BindingScalaDemo extends JSApp with App {

  case class Contact(name: Var[String], email: Var[String])

  val data = Vars(
    Contact(Var("Steve"), Var("steve@apple.com")),
    Contact(Var("Bill"), Var("bill@microsoft.com"))
  )

  @dom
  def table: Binding[Table] = {
    <table border="1" cellPadding="5">
      <thead>
        <tr>
          <th>Name</th>
          <th>E-mail</th>
        </tr>
      </thead>
      <tbody>
        {
          for (contact <- data) yield {
            <tr>
              <td>{contact.name.bind}</td>
              <td>{contact.email.bind}</td>
            </tr>
          }
        }
      </tbody>
    </table>
  }

  @JSExport
  def main(): Unit = {
    dom.render(document.body, table)
  }

}