DI container is not resolving dependencies

24 views
Skip to first unread message

Tomáš Lembacher

unread,
Nov 10, 2014, 11:19:44 AM11/10/14
to est...@googlegroups.com
Hi,

I have trouble with closure-dicontainer. For some unknown reason it is not resolving my dependencies. For example, I have these two react components:

goog.provide 'Menu'

class Menu
###*
@param {SubMenu} subMenu
@constructor
###
constructor: (@subMenu) ->
{div, ul} = React.DOM

@component = React.createFactory React.createClass

render: ->
div id: 'menu', ul, @subMenu.component

goog.exportSymbol 'Menu', Menu

and

goog.provide 'SubMenu'

class SubMenu

###*
@constructor
###
constructor: () ->
{div} = React.DOM

@component = React.createFactory React.createClass

render: ->
div id: 'subMenu'

goog.exportSymbol 'SubMenu', SubMenu

DiContainer created looks like this:

/**
 * Factory for 'Menu'.
 * @param {Object=} opt_rule
 * @return {Menu}
 */
app.DiContainer.prototype.resolveMenu = function(opt_rule) {
  var rule = /** @type {{
    resolve: (Object),
    as: (Object|undefined),
    with: ({
      subMenu: (SubMenu|undefined)
    }),
    by: (Function|undefined)
  }} */ (opt_rule || this.getRuleFor(Menu));
  var args = [
    rule['with'].subMenu!== undefined ? rule['with'].subMenu: void 0
  ];
  if (this.resolvedMenu) return this.resolvedMenu;
  this.resolvedMenu = /** @type {Menu} */ (this.createInstance(Menu, rule, args));
  return this.resolvedMenu;
};

Which is not, what I expect.

I can't see any difference between my code and code in songary repository (which I am using as inspiration). Is there any glitch?? Or how to make it work?

Thank you

Tomáš Lembacher

Daniel Steigerwald

unread,
Nov 14, 2014, 1:59:43 AM11/14/14
to est...@googlegroups.com
I don't know. Sorry. Use Songary as app boilerplate.

--
You received this message because you are subscribed to the Google Groups "Este.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to estejs+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages