Angularjs Scala.js与角型铸造

Angularjs Scala.js与角型铸造,angularjs,scala,scala.js,Angularjs,Scala,Scala.js,我正在尝试用Scala.JS和Angular实现一个应用程序,在提交表单时,我遇到了类型转换的问题 我有以下代码: <div ng-controller="usersCtrl"> <form novalidate class="simple-form"> First Name: <input type="text" ng-model="user.firstName" /><br /> Last Name: <input typ

我正在尝试用Scala.JS和Angular实现一个应用程序,在提交表单时,我遇到了类型转换的问题

我有以下代码:

<div ng-controller="usersCtrl">
<form novalidate class="simple-form">
    First Name: <input type="text" ng-model="user.firstName" /><br />
    Last Name: <input type="text" ng-model="user.lastName" /><br />
    E-mail: <input type="email" ng-model="user.email" /><br />
    Password: <input type="password" ng-model="user.password" /><br />
    ConfirmPassword: <input type="password" ng-model="user.passwordConfirmation" /><br />
    <input type="submit" ng-click="controller.signup(user)" value="Save" />
</form>
但是,当我尝试提交表单时,会出现以下错误:

$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
我尝试了几种选择,包括通过作用域获取用户,将用户变量定义为UserSignup或UndefOf[UserSignup],但没有成功。当我尝试执行scope.user.toOption时,后者失败


有什么想法吗?

Scala.JS无法自动将JS对象转换为Scala case类。您需要定义一个外观。提到 它应该是这样的:

@js.native
trait UserSignup extends js.Object { 
  def firstName: String = js.native
  def lastName: String = js.native
  ...
}

谢谢你的回答,看起来很有希望。添加@js.native注释时出现以下错误。我在这个项目中使用scala.js版本0.6.11:您遇到了什么错误?您是否正确导入批注?抱歉,未能添加批注。错误是:type native不是scala.scalajs.js包的成员这很奇怪,你能将
import scala.scalajs.js
添加到你的导入中吗?这是因为
scalajs stubs
没有实现
js.native
,我把代码和jvm代码放在一个共享文件夹中。
@js.native
trait UserSignup extends js.Object { 
  def firstName: String = js.native
  def lastName: String = js.native
  ...
}