Description
Requesting for TodoMVC guide for v2. Currently, the example uses
var app = app || {};
app.controller = function () {
and
app.view = (function () {
var focused = false;
return function (ctrl) {
return [
m('header.header', [
m('h1', 'todos'), m('input.new-todo[placeholder="What needs to be done?"]', {
However this pattern isn't documented (last was in v0.2.5). The Simple application tutorial uses either
view: function(){...}
or view: function(vnode){...}
.
The view receives accepted
or 'completed
from the URL capture '/:filter' as the filter
property on the ctrl
argument populated by controller()
.
In modern mithril (>=v2)/Simple application tutorial it comes in by vnode.attrs.filter? The TodoMVC example still works on v2, how did the view function know it was receiving (old-style) ctrl or vnode?
in view: function(vnode){}
I would expect the URL capture /:filter
(filter = "active" or "completed"
) to appear as vnode.attrs.filter
. However the received argument ctrl
does not seem to be polymorphic (it does not have an attrs
property).
Metadata
Metadata
Assignees
Labels
Type
Projects
Status