Created
March 8, 2011 03:33
-
-
Save MikailCliftov/859808 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Custom View: This works | |
Todos.ScrollingList = SC.View.extend( | |
/** @scope Todos.ScrollingList.prototype */ { | |
render: function(context){ | |
var template = SC.TEMPLATES['todos'](); | |
context.push(template); | |
} | |
}); | |
working template: | |
<h1>Todos</h1> | |
Kaboom template: | |
<h1>Todos</h1> | |
{{#view "Todos.CreateTodoView"}} | |
<input id="new-todo" type="text" placeholder="Wot?" > | |
{{/view}} | |
Todos.CreateTodoView is defined: | |
Todos.CreateTodoView = SC.TemplateView.create(SC.TextFieldSupport, { | |
insertNewline: function() { | |
var value = this.get('value'); | |
if (value) { | |
Todos.todoListController.createTodo(value); | |
this.set('value', ''); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment