I made a subclass of goog.ui.Component:
/**
* Renders the bottom pane.
* @param {!myapp.Entity} entity An entity.
* @param {goog.dom.DomHelper=} opt_domHelper Optional DOM helper.
* @constructor
* @extends {goog.ui.Component}
*/
myapp.BottomPane = function(entity, opt_domHelper) {
goog.base(this, opt_domHelper);
this.setModel(entity);
}
goog.inherits(myapp.BottomPane, goog.ui.Component);
However, when I run my javascript, Chrome Console notes that Uncaught TypeError: Object #<Object> has no method 'setModel'. I set a breakpoint and realized that, indeed, my myapp.BottomPane instance lacked a setModel method in the prototype chain. This is odd since the documentation notes that all components have this method: http://closure-library.googlecode.com/svn/docs/class_goog_ui_Component.html
Why does my goog.ui.Component lack a setModel method? I know that the call to goog.base(this, opt_domHelper); is working because my object has a DOM helper.
I was able to reproduce the error
Object #<Object> has no method 'setModel'by executing the constructormyapp.BottomPanewithout using thenewkeyword.Make sure to use
newto create instances.