模型本身的骨干模型访问静态方法

时间:2015-03-12 17:03:17

标签: javascript backbone.js

如何在模型函数本身内访问模型的静态方法?

例如,说我有以下内容:

var Model = Backbone.Model.extend({
    tableName : 'models',
    someFunction: function() {
        // Want to access 'someArray' here
    }
}, {
    someArray: ['a', 'b', 'c']
});

1 个答案:

答案 0 :(得分:-1)

var Model = Backbone.Model.extend({
    tableName : 'models',
    someFunction: function() {
        console.log(Model.someArray);
    }
}, {
    someArray: ['a', 'b', 'c']
});