在twitter bootstrap popover中插入主干渲染视图,如下所示.问题是当插入内容选项时,该视图的主干事件不会触发.我在div中插入视图以进行测试,使用$(选择器).html attendanceShow.render().el events工作没有问题.先感谢您
attendance = new Attendance()
attendance.url = "#{attendanceUrl}/#{attendanceId}"
attendance.fetch
success: ->
attendanceShow = new ExamAttendanceShow({model: attendance })
currentTarget.popover
html : true
content: ->
attendanceShow.render().el
Run Code Online (Sandbox Code Playgroud)
最好的问候,Georgi.
浏览Rails代码库,我发现了很多对options.dup的引用.
def to_xml(options = {})
require 'builder' unless defined?(Builder)
options = options.dup
....
end
Run Code Online (Sandbox Code Playgroud)
显然,options.dup正在复制选项哈希,但为什么你希望在这种情况下这样做呢?
我有以下数组
['a', 'b', 'c']
Run Code Online (Sandbox Code Playgroud)
如何将其转换为散列,如下所示:
{'a' => { position: index of array element a }, 'b' ...., 'c' ... }
Run Code Online (Sandbox Code Playgroud)
最好的问候乔治。