I'm trying to take the simple TodoMVC demo application from the emberjs.com website (http://emberjs.com/guides/getting-started/) and add some functionality to it, in order to learn more about how Ember works. I've run into a variety of "gotchas" so far that I've managed to get past, but now I'm completely stuck.
The primary feature I'm trying to add to the application now is having multiple lists, each with their own set of items. The request is being handled by the correct Controller and action, but a new List record won't get created. The specific error I am getting is "TypeError: type._create is not a function".
Can anyone tell me what that error means, and/or what I'm doing wrong here?
Here's the code that I'm working with at the moment:
Ember : 1.4.0
Handlebars : 1.3.0
jQuery : 1.11.0
Todos.ListsController = Ember.ArrayController.extend({
actions: {
createList: function() {
var title = this.get('newList');
if(!title.trim()) { return; }
var list = this.store.createRecord('list', { title: title });
this.set('newList', '');
list.save();
}
}
});
Todos.List = DS.Model.extend({
title: DS.attr('string')
});
<header class="header">
<h1>Lists</h1>
{{input type="text" id="new-list" placeholder="Add a List" value=newList action="createList"}}
</header>
<section class="main">
<ul id="todo-lists">
{{#each list in controller}}
<li>
<label>{{list.title}}</label>
<button class="destroy"></button>
</li>
{{/each}}
</ul>
</section>