This is my code.
/ ********************************************* * ***** /
import Ember from "ember"; var TodosController = Ember.ArrayController.extend({ actions: { createTodo: function(){ // Get the todo title by the "New Todo" input var title = this.get('newTitle'); if(!title.trim()){ return; } // Create the new Todo model var todo = this.store.createRecord('todo', { title: title, isCompleted: false }); // Clear the 'New Todo' input field this.set('newTitle', ''); // Save the new model todo.save(); }, clearCompleted: function(){ var completed = this.filterBy('isCompleted', true); completed.invoke('deleteRecord'); completed.invoke('save'); } }, remaining: function() { return this.filterBy('isCompleted', false).get('length'); }.property('@each.isCompleted'), inflection: function() { var remaining = this.get('remaining'); return remaining === 1 ? 'todo' : 'todos'; }.property('remaining'), hasCompleted: function(){ return this.get('completed') > 0; }.property('completed'), completed: function(){ return this.filterBy('isCompleted', true).get('length'); }.property('@each.isCompleted'), allAreDone: function(key, value) { if(value === undefined){ return !!this.get('length') && this.everyProperty('isCompleted', true); } else { this.setEach('isCompleted', value); this.invoke('save'); return value; } }.property('@each.isCompleted') }); export default TodosController;
/ ********************************************* * ****** /
The terminal does not display any error while executing this command
$ ember server
but nothing is displayed in the browser and the console shows this error
Unsolved error: claim failed: ArrayProxy expects an array or Ember.ArrayProxy, but you passed an object
Please tell me what I'm doing wrong, the code is also on github: https://github.com/narayand4/emberjs
early.
source share