gpt4 book ai didi

ruby-on-rails - rails erb 中的 Angular Js 花括号

转载 作者:行者123 更新时间:2023-12-03 15:49:58 25 4
gpt4 key购买 nike

有谁知道是否可以渲染有 Angular 的js花括号类型{{}}
在 ERB 中作为参数。

例如。

 <=home_url( {{code.id}}, @code)/>

最佳答案

取自 here 的示例:

<div>
<label>Name:</label>
<input type="text" ng-model="yourName" placeholder="Enter a name here">
<hr>
<h1>Hello {{yourName}}!</h1>
</div>

另请查看本教程: http://blog.berylliumwork.com/2013/03/best-practice-of-using-angularjs-with.html

你可以在哪里看到这个例子:
<div data-ng-init='mailbox.selected = "<%= @current_page %>"'>
<ul class="nav nav-tabs">
<li data-ng-class='{active: (mailbox.selected == "inbox")}'>
<%= link_to mails_inbox_path, 'Inbox' %>
</li>
<li data-ng-class='{active: (mailbox.selected == "outbox")}'>
<%= link_to mails_outbox_path, 'Outbox' %>
</li>
<li data-ng-class='{active: (mailbox.selected == "draft")}'>
<%= link_to mails_draft_path, 'Draft' %>
</li>
</ul>
</div>

关于ruby-on-rails - rails erb 中的 Angular Js 花括号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23084949/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com