私はこの記事でbackbone.jsでチェーン選択を行っていますhttp://blog.shinetech.com/2011/07/25/cascading-select-boxes-with-backbone-js/、しかし、クラスを拡張するときにエラーが発生しました。Backbone.js - Coffeescript extends
だから、私はLocationsViewクラスを持っている:
class Blog.Views.LocationsView extends Backbone.View
events:
"change": "changeSelected"
CountriesViewクラス:
class Blog.Views.CountriesView extends Blog.Views.LocationsView
setSelectedId: (countryId) ->
CitiesViewクラス:
class Blog.Views.CitiesView extends Blog.Views.LocationsView
setSelectedId: (cityId) ->
しかし、CoffeeScriptのコードはjavascriptの私の二重の拡張クラスのルックスにコンパイルしますlike:
(function() {
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
cities_view.js:5 Uncaught TypeError: Cannot read property 'prototype' of undefined
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
Blog.Views.CitiesView = (function() {
__extends(CitiesView, Blog.Views.LocationsView);
function CitiesView() {
CitiesView.__super__.constructor.apply(this, arguments);
}
CitiesView.prototype.setSelectedId = function(cityId) {};
return CitiesView;
})();
}).call(this);
と私はエラーが得た:
だから、Uncaught TypeError: Cannot read property 'prototype' of undefined cities_view.js:5
、問題は、どのようにそれを修正するためにされていますか?
完全なスタックトレースを提供できますか? – thejh