I want to implement the following Javascript code in Coffeescript
App.ItemView = Ember.View.extend({
classNameBindings: ['itemId'],
itemId: function() {
console.log(this.get('content'));
return "item-%@".fmt(this.get('content.id'));
}.property('content.id'),
templateName: 'item'
});
Here is what I have so far in coffeescript:
App.ItemView = Ember.View.extend(
classNameBindings: ['itemId']
itemId: ->
console.log this.get('content')
contentId = this.get('content.id')
"item-#{contentId}");
.property('content.id')
templateName: 'item'
)
I get:
Error: Parse error on line 11: Unexpected '.'
The issue seems to be with the dot in .property('content.id')
. I dont know how this translates into Coffeescript. How can I properly implement this view in Coffeescript?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…