title: How to parse a Dojo custom widget
body: <p>I'm having some trouble with writing my own widget.  I've created a widget that inherits from _WidgetBase, _TemplatedMixin and _WidgetsInTemplateMixin (as I'm also trying to build a UI where the widgets will contain other widgets).  I'm loading the markup for the widget from a template using dojo/text.  Here is a snippet:</p>
  
  <pre><code>define([
  "dojo/_base/declare",
  "dijit/_WidgetBase",
  "dijit/_TemplatedMixin",
  "dijit/_WidgetsInTemplateMixin",
  "dojo/text!./templates/LayerManagerWidget.html"
  ], function (declare, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, template) {
      return declare("myApp.ui.platforms.desktop.widgets.LayerManagerWidget", [_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], {
  
          // summary:
          //     This widget provides the layer manager user interface component
  
          // templateString: string
          //     Inherited from _TemplatedMixin, used to specify an HTML file to provide the markup
          templateString: template
  
      });
  
  });
  </code></pre>
  
  <p>It's working to some degree and I think the problem is with parsing.  Because the widgets aren't all required right from the start, I don't think they are being parsed.  Some of the examples on the dojo widget tutorials include dojo/ready and dojo/parser in the widget and parse it but I haven't been able to work out how to do this: those same examples don't have a 'return' before the declare statement which I don't quite understand as then how do you then later instantiate the widget with something like var myWidget = new MyWidget(); ?</p>
  
  <p>So I guess the main part of the question is, in the above example, where do I put a parser.parse() call (or in general, how do I make sure this widget gets parsed)?</p>
  
  <p>Thanks!</p>