Skip to content

Commit

Permalink
add templates/page/counter.html.leex for rendering counter in Live View
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Jun 6, 2019
1 parent 37ebe35 commit 96432e8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
8 changes: 1 addition & 7 deletions lib/live_view_counter_web/live/counter_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ defmodule LiveViewCounterWeb.CounterLive do
@topic "live"

def render(assigns) do
~L"""
<div>
<h1>The count is: <%= @val %></h1>
<button phx-click="dec">-</button>
<button phx-click="inc">+</button>
</div>
"""
LiveViewCounterWeb.PageView.render("counter.html", assigns)
end

def mount(_session, socket) do
Expand Down
5 changes: 5 additions & 0 deletions lib/live_view_counter_web/templates/page/counter.html.leex
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div>
<h1>The count is: <%= @val %></h1>
<button phx-click="dec">-</button>
<button phx-click="inc">+</button>
</div>

0 comments on commit 96432e8

Please sign in to comment.