diff --git a/UI/Mixins/AsModelBoundView.js b/UI/Mixins/AsModelBoundView.js index 13814b14a..7d1c961f7 100644 --- a/UI/Mixins/AsModelBoundView.js +++ b/UI/Mixins/AsModelBoundView.js @@ -10,10 +10,17 @@ define( originalBeforeClose = this.prototype.onBeforeClose; this.prototype.onRender = function () { - if (this.model) { + + if (!this.model) { + throw 'View has no model for binding'; + } + + if (!this._modelBinder) { this._modelBinder = new ModelBinder(); - this._modelBinder.bind(this.model, this.el); } + + this._modelBinder.bind(this.model, this.el); + if (originalOnRender) { originalOnRender.call(this); }