javascript - Ember createRecord error -
I'm trying to follow, but with some differences. Most especially, I'm using precompiled templates. Here's what I found without the dirty template code:
window.App = Ember.Application.create ({LOG_TRANSITIONS: true, VERSION: '1.0.0', ready: function () {Console.log ('App version:' + App.VERSION + 'is ready.');}}); App.Store = DS.Store.extend ({// Usage fixtures - I have tried it without expanding the adapter: DS.FixtureAdapter.extend ()}); App.Router.map (function () {this.route ("todos", {path: "/"})}}; app.TodosRoute = Ember.Route.extend ({model: function () {this return.store .find ('todo');}, renderTemplate: function () {this.render ('todos', {outlet: 'main'});}}); app.Todo = DS.Model.extend ({title: DS.attr ('string') is complete: DS.attr ('boolean')}; app.Todo.FIXTURES = [{id: 1, title: 'learn amber.js', complete: true}, {ID: 2, Title: '...', complete: wrong}, {id: 3, title: 'profit!', Complete: wrong}]; App.TodosController = Ember.ArrayController.extend ({actions : {CreateTodo: function () {// Get the Todo title set by "new tabo" text field var title = this.get ('newTitle'); if (! Shi } {Return title;} Title.trim ()) {return;} // Create new Todo model todo = this.store.createRecord ('todo', {title: title, iscompleted: false}); / Clear the "New Toado" text field this.set ('newTitle', ''); // new model todo.save ();}}});
As you can see, the Todos route presents the todos
template in the main
outlet. They do all these work perfectly. However, the problem I am facing now is in this.store.createrecord
in TodosController
. Every time it is called (to enter the input field of the app by me), I get a unkot type error: there is no undefined function
I know that the function is being called , Because I can log the this.store.createrecord
console output before calling. I'm on Amber's version 1.6.1 and amber-data version 0.14, if it helps.
If anyone has any idea about why this might happen, I would appreciate it.
You need to upgrade your amber-data version if you have installed it with a key , You can change the version in your bower.json ( "ember-data": "~ 1.0.0-beta.8"
) and bower install
.
Comments
Post a Comment