我的模型中有一个简单的函数,如果优先级为 100,它应该返回 true
class App.Models.Publication extends Backbone.Model
urlRoot: '/api/publications'
isIncredible: ->
@get('priority') is 100
在视图中我想调用该函数,但我不能
class App.Views.PublicationShow extends Backbone.View
tagName: 'article'
className: 'offer'
template: JST['publications/show']
render: =>
if @model.isIncredible()
$(@el).addClass('incredible').html(@template(publication: @model))
else
$(@el).html(@template(publication: @model))
@modalEvent()
this
我得到:TypeError: this.model.isIncredible is not a function
就像我正在使用咖啡脚本一样