Sergey Makridenkov
Sergey Makridenkov

Reputation: 624

How to use content_for in kemal slang

content_for does not work for me. I use Kemal and Slang. Here code:

layout.slang

== yield_content "js_css"

index.slang

- content_for "js_css" do
  javascript:
    window.allowDigits = function(evt) {
      alert("msa7");
    }

In output HTML I do not see alert("msa7"). What wrong with my code?

Upvotes: 0

Views: 124

Answers (1)

Sergey Makridenkov
Sergey Makridenkov

Reputation: 624

Found workaround by call content_for with file name, like this content_for "js_css", "src/views/session/index.slang". Now it works:

index.slang

- content_for "js_css", "src/views/session/index.slang" do
  javascript:
    window.allowDigits = function(evt) {
      alert("msa7");
    }

Upvotes: 1

Related Questions