Mithril Containers
by ramnathv
CoffeeScript
CommentList =
view: (c, props) ->
m 'ul', props.users.map (u) -> m 'li', u.name
#myList = m.component(CommentList, {users: [{name: "A"}, {name: "B"}]})
#m.mount(document.body, myList)
CommentListContainer =
controller: ->
users: m.request
method: "GET"
url: "http://jsonplaceholder.typicode.com/users"
view: (c, props) ->
m 'div', m.component(CommentList, {users: c.users()})
m.mount(document.body, CommentListContainer)