phoenix_live_view icon indicating copy to clipboard operation
phoenix_live_view copied to clipboard

raise when declaring global attr within a slot

Open chrismccord opened this issue 2 years ago • 1 comments

chrismccord avatar Aug 30 '22 17:08 chrismccord

I just ran into this issue when trying to define a select input with values. Usage was like this:

~H"""
<.input type="select" field={{f, :energy}} label="Energy Level">
      <:option value="" hidden={true}>Select an option</:option>
      <:option :for={value <- Ecto.Enum.values(Canvas, :energy)} value={value}>
        <%= value %>
      </:option>
 </.input>
"""

How could I provide the other attributes of an option without having to define each individually? My current idea is using assigns_to_attributes(opt, [:value]) however then there is the compile time warning of passing in attributes which are unknown.

Carl-Foster avatar Oct 03 '22 02:10 Carl-Foster