bullgare
bullgare

Reputation: 1763

Haml.js: Is there any way to insert dynamic attribute value?

There's what I want to do:

%input.current-page( type="text" value=currentPageNum )

where currentPageNum is dynamic.

That's how I invoke this template:

@$el.html( Haml.render( @template, { locals: { currentPageNum: @currentPageNum } } ) )

This Question is about haml.js but I don't have enough reputation to create new tag here

Upvotes: 0

Views: 855

Answers (1)

bullgare
bullgare

Reputation: 1763

I found an answer:

%input.current-page{ type: "text", value: "#{currentPageNum}" }

Further reading:

https://github.com/creationix/haml-js/blob/master/test/embedded_code.haml

comparing with

https://github.com/creationix/haml-js/blob/master/test/embedded_code.html

Upvotes: 2

Related Questions