且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Rhomobile中将变量传递给Partial

更新时间:2022-04-23 00:05:01

您可以使用此处指定的本地或集合

You can use the locals or collections as specified over here http://docs.rhomobile.com/rhodes/ui#advanced-usage-of-render

<%= render :partial =>"mypartial", :locals => { :event => "myevent" } %>

然后局部使用,像

<div class="eventList"><%= event %></div>

第二,如果您为控制器中的实例变量分配了一些值,

Second, if you assign some value to the instance variable in the controller,

@event = "myevent"

然后您可以在部分内部直接访问它,

then you can directly access it inside the partial as below,

<div class="eventList"><%= @event %></div>

这些是您可以用来传递变量的一些方法.

These are some of the ways you can use to pass the variables.