Scala.js with angular type casting
<p>I am trying to implement an application with Scala.JS and Angular and I am facing a problem with type casting when submitting the form.</p>

<p>I have the following code:</p>

<pre><code>&lt;div ng-controller="usersCtrl"&gt;
&lt;form novalidate class="simple-form"&gt;
    First Name: &lt;input type="text" ng-model="user.firstName" /&gt;&lt;br /&gt;
    Last Name: &lt;input type="text" ng-model="user.lastName" /&gt;&lt;br /&gt;
    E-mail: &lt;input type="email" ng-model="user.email" /&gt;&lt;br /&gt;
    Password: &lt;input type="password" ng-model="user.password" /&gt;&lt;br /&gt;
    ConfirmPassword: &lt;input type="password" ng-model="user.passwordConfirmation" /&gt;&lt;br /&gt;
    &lt;input type="submit" ng-click="controller.signup(user)" value="Save" /&gt;
&lt;/form&gt;
</code></pre>

<p></p>

<pre><code>@JSExport
@injectable("usersCtrl")
  class UsersCtrl(
  scope: UsersScope,
  proxy: UsersServiceProxy,
  val timeout: Timeout)
extends AbstractController[UsersScope](scope) {

  @JSExport
  def signup(user: UserSignup): Future[User] = {
    proxy.signup(scope.user)
  }
}


@JSExportAll
case class UserSignup(firstName: String, lastName: String, email: String, password: String, passwordConfirmation: String)
</code></pre>

<p>But when I try to submit the form I get the following error:</p>

<pre><code>$c_sjsr_UndefinedBehaviorError {s$1: "An undefined behavior was detected: [object Object] is not an instance of rentalot.users.UserSignup", e$1: $c_jl_ClassCastException
</code></pre>

<p>I have tried several options, including getting the user via the scope, with having a user variable defined either as an UserSignup or as UndefOf[UserSignup] but with no luck. The latter fails when I try to do scope.user.toOption.</p>

<p>Any thoughts?</p>