B
B
Bogdan2017-05-16 13:29:36
JavaScript
Bogdan, 2017-05-16 13:29:36

RAILS and assets J?

Hello, but how to freely organize the binding to View javascript. Now I create a file in app/assets/javascripts/ for each View. And then already in the file itself I check for the presence of the main element.
Or is there a more elegant way? Thanks

$( document ).on 'turbolinks:load', ( ) ->

  $ioCorrectionProducts = $( '#io_correction_products' )
  if $ioCorrectionProducts.length
    # делаем настройки и привязки к элементам

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question