Dynamic computed properties in Ember.JS deprecated. The computed property is only deprecated on the create() function of an object. If you wish to create a computed property, then you must first extend() the object, and then create() it.
Here is an example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | // The Controller Todos.TodosController = Ember.Controller.extend({ // ** SNIP ** // countCompleted: function() { return this.get('todos').filterProperty('completed', true).length }.property(), }); // Note the lower case 't' here. We've made a new object Todos.todosController = Todos.TodosController.create(); // The View // We reference the created object here (note the lower // case 't' in 'todosController') {{Todos.todosController .countCompleted.property}} Items Left |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.