Reputation: 741
Computed properties on ember views have the form
myComputedProperty: function() {
return doSomething();
}.property()
However, when I write this in coffescript as
myComputedProperty: ->
doSomething()
.property()
I get an error like "Parse error on line 5: Unexpected '.'". Am I doing something wrong, or is this a quirk of the interpreter I'm using (Mindscape VS plugin)?
Upvotes: 1
Views: 94
Reputation: 14400
You can add ()
around the function, or you can make the syntax more coffeescript friendly:
prop = (fn) -> fn.property()
myComputedProperty: prop ->
doSomething()
Upvotes: 1
Reputation: 9345
The grammar of the language doesn't support this. You have to add parenthesis around the function:
myComputedProperty: (->
doSomething()
).property()
Upvotes: 1