Skip to content

Call Component class from a html file #28

Closed Answered by joeldrapper
enderahmetyurt asked this question in Help
Discussion options

You must be logged in to vote

You should be able to include Phlex components like this.

<%= NavComponent.new.call.html_safe %>

But it looks like your NavComponent hasn't even been loaded. If you put the NavComponent in app/components/nav_component.rb it should be loaded automatically. I’d like to create a helper method for Rails so you can include them with just <%= component NavComponent %>. This should be part of #1.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@enderahmetyurt
Comment options

Answer selected by enderahmetyurt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants