[英]Why are my ruby tags not being recognised on js erb file?
The file is saved as application.js.erb I am trying to use some ruby code as a condition to run my sweet alert.该文件保存为 application.js.erb 我正在尝试使用一些 ruby 代码作为运行我的甜蜜警报的条件。
import { initSweetalert } from '../plugins/init_sweetalert';
if (<% !@user.clients.last.present? %>)
initSweetalert('#sweet-alert-location', {
title: "Location Alert",
text: "Location can not be changed until you have clicked start",
icon: "warning"
});
The ruby tags are not being recognised in my code ruby 标签在我的代码中未被识别
Any Help would be greatly appreciated任何帮助将不胜感激
replace代替
<% !@user.clients.last.present? %>
with和
<%= !@user.clients.last.present? %>
You forgot equal sign你忘了等号
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.