Any tips or advice on when it is appropriate to use straight javascript functions vs computed properties inside a controller?
Beside calling syntax differences, are there any other important considerations to take into account?
I presume you lose out on some of the observer functionality. And implicitly calls to your function are synchronous so any advantages of the ember run loop are lost. Access to function is not possible in handlebars template unless it is a property?
What about custom promises in the controller?
I am trying to figure out it is OK to use the first approach of these two
App.ApplicationController = Ember.Controller.extend({
myProperty: "some prop",
myMethod: function () {
var variable = "foo";
return variable;
}
});
vs
App.ApplicationController = Ember.Controller.extend({
myProperty: "some prop",
myMethod: function () {
var variable = "foo";
return variable;
}.property()
});
Obviously the calling syntaxes are different.
elsewhere in a route…
basic function:
this.controller.myMethod();
vs property
this.controller.get('myMethod');
Are there cases where it doesn’t make sense to use a computed property?