Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Components registered using object form in a lazy-loaded module are not loaded #156

Closed
mrcrowl opened this issue Mar 31, 2015 · 3 comments
Closed

Comments

@mrcrowl
Copy link

mrcrowl commented Mar 31, 2015

When we register directives in our lazy-loaded modules, we tend to use an object variable to hold all of the directives and then register them in one go. Something like this:

var gameDirectives = {
   "gameStarLevel": GameStarLevel.directive, 
   "gameCrossbow": GameCrossbow.directive
}

angular.module("game", []).directive(gameDirectives);

Unfortunately, ocLazyLoader doesn't seem to recognise the object-form of component registration, and requires us to use this form:

angular.module("game", [])
    .directive("gameStarLevel", GameStarLevel.directive)
    .directive("gameCrossbow", GameCrossbow.directive);

See: http://plnkr.co/edit/DWaf9o1bZOHeTzk0FoQh?p=preview

@ocombe
Copy link
Owner

ocombe commented Apr 9, 2015

I've never seen such a thing, but according to the documentation it's real:

name (string|Object)
Controller name, or an object map of controllers where the keys are the names and the values are the constructors.

I'll add the support for it if I can :)

@ocombe ocombe added the bug label Apr 9, 2015
@ocombe ocombe added this to the 1.0 - Stable api & modularity milestone Apr 9, 2015
@ocombe ocombe closed this as completed in 08ed860 Apr 9, 2015
@ocombe
Copy link
Owner

ocombe commented Apr 9, 2015

Fixed! Thanks for the report, I learned a new thing with this :)

@mrcrowl
Copy link
Author

mrcrowl commented Apr 11, 2015

Thanks for the quick fix Oliver. Nice refactoring too.
On Fri, 10 Apr 2015 at 8:30 am, Olivier Combe notifications@github.com
wrote:

Fixed! Thanks for the report, I learned a new thing with this :)


Reply to this email directly or view it on GitHub
#156 (comment).

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants