I have a rails application that serves several views that include specific data from a database that some javascript will handle, especially for use with Chartjs.
The options I learned are as follows:
<script>
It seems to me that the solution should include an asset pipeline and some rail interpolation, but I cannot get this work to work very cleanly. What are the elegant rails to solve this problem?
Thanks everyone!
javascript, ( ) :
, , ERB javsacript. , .
. HAML, , "data-my-variable", javascript ( jQuery: $(element).data("my-variable")).
$(element).data("my-variable")
- , , , .
HAML, ERB , Mandeep, , HAML:
%a{"data-my-variable" => "my data", href: "#"}
%a{href: "#", :data => {:my_variable => "my data"}}
EDIT: , , , , , , :)
Source: https://habr.com/ru/post/1530265/More articles:How to add a non-overlapping legend to match colors to categories in pairs ()? - rWebSocket connection delay without localhost - javaopencv: namedWindow () error "cannot open display"! - c ++Replacing matlab search function in python - pythonHow to get the active name of the application window, as shown in the task manager - c #How to get the name of the active window? - cНужны ли устройства Android для питания USB, чтобы поддерживать пользовательские аксессуары USB? - androidФормула Excel для поиска, если все ячейки в диапазоне читаются "True", если нет, то покажите "False", - containsDeny blacklisting user registration in Rails - securityKnockout how to subscribe to every change in an observable array - javascriptAll Articles