Google closure: goog.require could not find: goog.ui
I'm learning google closure, and when I try to use the goog.ui component (any class thereof), I get the error goog.require could not find: goog.ui.
My code is:
goog.require('goog.dom'); goog.require('goog.json'); goog.require('goog.events'); goog.require('goog.ui.HoverCard'); goog.require('goog.positioning.AnchoredPosition'); goog.require('goog.positioning.Corner'); goog.require('goog.ui.Component.EventType'); goog.require('goog.ui');
The other components (at least before I try to load any ui element) work just fine.
Any suggestions on what this could be? I have the version cloned from git about two days ago. I'm not compiling, because at this stage I just want to figure out how to write the code.
You can use goog.require() on elements that have been provided by a goog.provide() before.
goog.ui is never provided because it's not a component or something that you can use directly with "static" methods (Contrary to goog.events that has listen() methods for instance). It's just a naming convention to regroup all visual components.
However, you can do a goog.require('goog.ui.Component') or goog.require('goog.ui.Button') for instance.
I was able to eliminate this by:
Loading the base.js file directly from google's git repository: http://closure-library.googlecode.com/git/closure/goog/base.js;
Eliminating the attempt to require 'goog.ui' separately from any subcomponent thereof; and
Moving the require calls into the HTML head directly (inside a script tag), rather than having them in a script loaded in the head.
This doesn't seem entirely satisfactory.