Delete link not working phoenix

后端 未结 5 1942
遥遥无期
遥遥无期 2021-01-04 11:09

I\'ve used Phoenix\'s built in gen.HTML to generate a simple view but it\'s not working

<%= link \"Delete\", to: event_path(@conn, :delete, event), method         


        
相关标签:
5条回答
  • 2021-01-04 11:37

    I recently had the same issue, it turns out that I had accidentally deleted the <script src="<%= static_path(@conn, "/js/app.js") %>"></script> from my layout.html.eex file. Adding it back fixed the issue.

    0 讨论(0)
  • 2021-01-04 11:45

    For anyone else hitting this I had a completely different problem that manifested itself in the same way, will drop this here in case it helps:

    It turns out I accidentally deleted import "phoenix_html" from the app.js file mistaking it for being part of the generated boilerplate, adding it back fixed my issue.

    0 讨论(0)
  • 2021-01-04 11:53

    Edit: This happens to be known issue. Here is the fix:

    In brunch-config.js
    autoRequire: {
      "js\\app.js": ["web/static/js/app"]
    }
    

    Source

    0 讨论(0)
  • 2021-01-04 11:53

    While not the particular solution to OP's issue, this error can also arise if you place

    <script src="<%= static_path(@conn, "/js/app.js") %>"></script>

    in the the wrong place in app.html.eex. (For example inside <head> instead of at the end of the body)

    0 讨论(0)
  • 2021-01-04 12:01

    For later versions of Phoenix, if you view the app.js file within priv/static/js/app.js you'll notice a comment that references a link to a raw github js file. This small snippet of Javascript contains important code to ensure that the delete link helpers actually work correctly.

    0 讨论(0)
提交回复
热议问题