【发布时间】:2015-05-20 17:37:42
【问题描述】:
我在带有 AngularJS 和 haml 的 Rails 3.2 应用程序下使用 simple_form。
我有这个输入字段,我们在其中存储成本,我想使用 angularjs 指令“form-cents-to-dollars”,但 simple_form input_html 选项需要一个带值的键,这只是AngularJS 调用它的键或属性。
= f.input :cost_per_unit_cents,
input_html: {class: 'money',
"ng-model" => "timesheet.cost_per_unit_cents",
"ng-init" => "timesheet.cost_per_unit_cents=#{@timesheet.cost_per_unit_cents}",
"ng-change" => "line_item_service.calc_total()",
"form-cents-to-dollars" }
我在运行此代码时遇到的错误是“语法错误,意外 },期待 =>。
是否可以使用简单的形式只设置“键”?或者有没有办法将它作为键/值对发送到 AngularJS,这将与属性指令一起使用?
【问题讨论】:
标签: javascript ruby-on-rails angularjs simple-form