Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

are there breaking changes in 0.5.2 for Angular 1.3 #111

Closed
robertdunaway opened this issue Jan 2, 2015 · 27 comments
Closed

are there breaking changes in 0.5.2 for Angular 1.3 #111

robertdunaway opened this issue Jan 2, 2015 · 27 comments
Labels

Comments

@robertdunaway
Copy link

I tried to upgrade my ocLazyLoad to 0.5.2 and I'm getting errors. I'm not sure where to start on debugging it so I though I'd ask if there are known issues.

Here is what I get.

"[$injector:modulerr] http://errors.angularjs.org/1.3.0/$injector/modulerr?p0=oc.lazyLoad&p1=Erro…alhost%3A50001%2Fcore%2Flib%2FangularJS%2F1.3.0%2Fangular.min.js%3A7%3A302)"

@ocombe
Copy link
Owner

ocombe commented Jan 2, 2015

Hmm there shouldn't be any breaking change, no. I'll check it out tomorrow.
What version of angular 1.3 did you use?

@robertdunaway
Copy link
Author

Looks like I'm using 1.3.0 but I'll verify.

------ Original Message ------
Received: 03:51 PM EST, 01/02/2015
From: Olivier Combe notifications@github.com
To: ocombe/ocLazyLoad ocLazyLoad@noreply.github.com
Cc: robertdunaway robertdunaway@usa.net
Subject: Re: [ocLazyLoad] are there breaking changes in 0.5.2 for Angular 1.3 (#111)

Hmm there shouldn't be any breaking change, no. I'll check it out tomorrow.
   What version of angular 1.3 did you use?

—
  Reply to this email directly or view it on GitHub.

@robertdunaway
Copy link
Author

Ok, I verified and I was on 1.3.0. Just in case and because it's probably time anyway, I upgraded angular to 1.3.8.

Same problem.

Here is a route I have configured but since it happens on start up I'm only assuming this is the route that's failing. I configure all the routes exactly the same so that should help.

        .when('/', {
            templateUrl: 'apps/mashup/welcome/welcome.html',
            controller: 'mashup.welcomeController',
            controllerAs: 'vm',
            resolve: {
                loadMyCtrl: ['$ocLazyLoad', function ($ocLazyLoad) {
                    return $ocLazyLoad.load({
                        name: 'mashupApp',
                        files: ['apps/mashup/welcome/welcome.controller.js']
                    });
                }]
            , 
                sessionLoad: ['$route', 'sessionLoad', function ($route, sessionLoad) { return sessionLoad.loadCompleted(); }]
            }
        });
}]);

@ocombe
Copy link
Owner

ocombe commented Jan 2, 2015

Ok I just checked with 1.3.8 and it works just fine.
The error you're having means that the lib oc.lazyLoad is not loaded. Have you included the lib correctly ?

@curlyfro
Copy link

curlyfro commented Jan 4, 2015

i absolutely love this module. dynamic loading of modules and files are a definite need and should be core to angular.

however.... i seem to be having the same problem.

i'm using ui-router. i have an abstract route tree that have core dependencies to my application. from the resolve i'm lazily loading my controllers like above and from my controllers i'm injecting my dependencies. everything works great -- all my dependencies get injected until i load the last node in my route tree then i loose my dependencies and i get the above error.

i using angular 1.3. tried oclazyload .5.1 and oclazyload .5.2

@ocombe
Copy link
Owner

ocombe commented Jan 6, 2015

I cannot reproduce the problem, I tried with the minified version (thinking that maybe something was wrong here) and angular 1.3.8 but it works just fine (with the examples and with my app that uses the lib)...
Is there any chance that you could do me a plunkr with the problem ?

@robertdunaway
Copy link
Author

Maybe it's the way I'm using ocLazyLoad.  I can't upgrade and that's ok.

------ Original Message ------
Received: 09:21 AM EST, 01/06/2015
From: Olivier Combe notifications@github.com
To: ocombe/ocLazyLoad ocLazyLoad@noreply.github.com
Cc: robertdunaway robertdunaway@usa.net
Subject: Re: [ocLazyLoad] are there breaking changes in 0.5.2 for Angular 1.3 (#111)

I cannot reproduce the problem, I tried with the minified version (thinking that maybe something was wrong here) and angular 1.3.8 but it works just fine (with the examples and with my app that uses the lib)...
   Is there any chance that you could do me a plunkr with the problem ?

—
  Reply to this email directly or view it on GitHub.

@ocombe
Copy link
Owner

ocombe commented Jan 6, 2015

But it shouldn't be the case :(
If you have the time to make me a plunkr some day, I'd like to fix this.

@robertdunaway
Copy link
Author

I will. Thank you for the help.  I need to finish up a new task and then I'll come back and try again.

------ Original Message ------
Received: 09:39 AM EST, 01/06/2015
From: Olivier Combe notifications@github.com
To: ocombe/ocLazyLoad ocLazyLoad@noreply.github.com
Cc: robertdunaway robertdunaway@usa.net
Subject: Re: [ocLazyLoad] are there breaking changes in 0.5.2 for Angular 1.3 (#111)

But it shouldn't be the case :(
   If you have the time to make me a plunkr some day, I'd like to fix this.

—
  Reply to this email directly or view it on GitHub.

@curlyfro
Copy link

curlyfro commented Jan 6, 2015

i'm wondering if it's the way i'm using ocLazyLoad too. i put up a non working plunk (http://plnkr.co/edit/gsVOA9ZN2AEC0cSu6LnN?p=catalogue) but i hope it gets my point across.

i config my angular app and inject my core services ['kameeyo.core']. i write my routes scripts from serverside. from my routes i dynamically inject my controller but it doesn't see my Authentication service from kameeyo.core. i tried to dynamically load my core services but that didn't work either.

@curlyfro
Copy link

curlyfro commented Jan 6, 2015

my bad. it was my error. in my core files i was defining each of the modules the same name 'kameeyo.core'. i fixed by changing each of the module names and making sure the kameeyo.core module had all it's dependencies. thanks.

@ocombe
Copy link
Owner

ocombe commented Jan 6, 2015

Ah good to know :)

@tclift
Copy link

tclift commented Jan 14, 2015

Possibly related, I get:
No module found during bootstrap, unable to init ocLazyLoad
with 0.5.2 (working with 0.5.1) and angular 1.2.28.

Was not able to reproduce with a simple plunkr. Will try to simplify the failing code when I have the chance.

Very helpful library, thank you.

@ocombe
Copy link
Owner

ocombe commented Jan 14, 2015

This new error message "No module found during bootstrap, unable to init ocLazyLoad" has been added as a safeguard with 0.5.2 to avoid wrong initializations of ocLazyLoad that would lead to bugs later (modules loaded but undetected).
Could you give me a plunkr with the code that is throwing this exception please ? I need to find out why it is not detecting any module in the init phase.

@robmacg
Copy link

robmacg commented Jan 19, 2015

I'm getting the "No module found during bootstrap, unable to init ocLazyLoad" when running tests through Karma. Looking at the code, it appears that it is looking for an "ng-app" reference in the page being loaded, I think to get a list of already-loaded modules. But Karma starts up a stand-alone browser window with its own blank page in it. Is it possible to get ocLazyLoad to start properly under Karma?

@ocombe ocombe closed this as completed in ff6afcf Jan 20, 2015
@ocombe
Copy link
Owner

ocombe commented Jan 20, 2015

Ok guys, I think I fixed your problem AND added the compatibility with karma, could you all try the current master src file (this one from the src folder, not from dist) and let me know if it's ok ? I'll make a new release if that's the case

@robmacg
Copy link

robmacg commented Jan 21, 2015

Hi Olivier,
Partial success for me. I am no longer getting the problem of ocLazyLoad
failing to run because it doesn't find any modules. However my tests are not
running because of this:

    Error: [$injector:modulerr] Failed to instantiate module jsidApp due

to:

    Error: [$injector:modulerr] Failed to instantiate module

jsidMyAccount due to:

    Error: [$injector:modulerr] Failed to instantiate module oc.lazyLoad

due to:

    Error: [$injector:nomod] Module

'{"files":["apps/myProfile/controllers/personalDetails","apps/myProfile/cont
rollers/addressBook","apps/myProfile/controllers/payment"]}' is not
available! You either misspelled the module name or forgot to load it. If
registering a module ensure that you specify the dependencies as the second
argument.

http://errors.angularjs.org/1.2.26/$injector/nomod?p0=%7B%22files%22%3A%5B%2
2apps%2FmyProfile%2Fcontrollers%2FpersonalDetails%22%2C%22apps%2FmyProfile%2
Fcontrollers%2FaddressBook%22%2C%22apps%2FmyProfile%2Fcontrollers%2Fpayment%
22%5D%7D

        at 

/Users/rob/Repo/project-whistler/jsidentity/app/static/jsidentity/components
/bower/angular/angular.js:78:12

        at 

/Users/rob/Repo/project-whistler/jsidentity/app/static/jsidentity/components
/bower/angular/angular.js:1677:17

        at ensure

(/Users/rob/Repo/project-whistler/jsidentity/app/static/jsidentity/component
s/bower/angular/angular.js:1601:38)

        at module

(/Users/rob/Repo/project-whistler/jsidentity/app/static/jsidentity/component
s/bower/angular/angular.js:1675:14)

        at Object.angular.module

(/Users/rob/Repo/project-whistler/jsidentity/app/static/jsidentity/component
s/bower/ocLazyLoad/dist/ocLazyLoad.js:936:12)

        at addReg

(/Users/rob/Repo/project-whistler/jsidentity/app/static/jsidentity/component
s/bower/ocLazyLoad/dist/ocLazyLoad.js:903:34)

        at Object.forEach

(/Users/rob/Repo/project-whistler/jsidentity/app/static/jsidentity/component
s/bower/angular/angular.js:325:18)

        at addReg

(/Users/rob/Repo/project-whistler/jsidentity/app/static/jsidentity/component
s/bower/ocLazyLoad/dist/ocLazyLoad.js:909:17)

        at 

/Users/rob/Repo/project-whistler/jsidentity/app/static/jsidentity/components
/bower/ocLazyLoad/dist/ocLazyLoad.js:914:7

        at Object.forEach

(/Users/rob/Repo/project-whistler/jsidentity/app/static/jsidentity/component
s/bower/angular/angular.js:325:18)

Best regards, Rob

Rob Macgregor
Principal Consultant, Pirean Software.
Pirean - A Security Software and Consultancy Partner.

Email: rob.macgregor@pirean.com
Tel:+44 (0)2037 633 267
Mobile:+44 (0)7714 215 165
Web: www.pirean.com http://www.pirean.com/

From: Olivier Combe notifications@github.com
Reply-To: ocombe/ocLazyLoad
<reply+00a1c9638288aabbb2a2dcda3aee1e395c5e0b5d305b064592cf0000000110d655899
2a169ce032cf0db@reply.github.com>
Date: Tuesday, 20 January 2015 17:42
To: ocombe/ocLazyLoad ocLazyLoad@noreply.github.com
Cc: Rob Macgregor rob.macgregor@pirean.com
Subject: Re: [ocLazyLoad] are there breaking changes in 0.5.2 for Angular
1.3 (#111)

Ok guys, I think I fixed your problem AND added the compatibility with
karma, could you all try the current master src file (this one
https://github.com/ocombe/ocLazyLoad/blob/master/src/ocLazyLoad.js from
the src folder, not from dist) and let me know if it's ok ? I'll make a new
release if that's the case


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

Pirean - A Security Software and Consultancy Partner.

Pirean, One Canada Square, London, E14 5AA, United Kingdom. Registered in
England Number 4453109.

Any information, methodologies and intellectual property discussed in this
communication remains the intellectual property of Pirean Limited ©
Copyright 2002-2014, all rights reserved.

This e-mail is only intended for the person(s) to whom it is addressed and
may contain confidential information. Unless stated to the contrary, any
opinions or comments are personal to the writer and do not represent the
official view of the company. If you have received this e-mail in error,
please notify us immediately by reply e-mail and then delete this message
from your system. Please do not copy it or use it for any purposes, or
disclose its contents to any other person.

@ocombe
Copy link
Owner

ocombe commented Jan 21, 2015

Ok, do you have the piece of code that produced this bug please? I have an idea of what it might be but the code would help.
Thanks for the report.

@ocombe ocombe reopened this Jan 21, 2015
@robertdunaway
Copy link
Author

Sorry it took me a few days to update. I just updated my ocLazyLoad and it works like a dream. Thanks for the fix...

@ocombe
Copy link
Owner

ocombe commented Jan 21, 2015

Ok, I just need to fix the bug that @robmacg reported before I make a new release.
Also if @tclift could test the file too, that would be nice :)

@arush
Copy link

arush commented Feb 2, 2015

@ocombe @robertdunaway i can also confirm that the fix works, waiting on the release

@uglow
Copy link

uglow commented Feb 16, 2015

@ocombe I can also confirm that this fix works. Waiting on release. In our case we were using Angular 1.2.18 and ocLazyLoad 0.5.2.

@tclift
Copy link

tclift commented Feb 19, 2015

@ocombe This appears to have fixed the issue I was seeing, however now I get a new error. We are using ng-lodash and they are using a trick in the way it is defined / provided:

angular.module('ngLodash', []).constant('lodash', null).config([
  '$provide',
  function ($provide) {
    // ...
    $provide.constant('lodash', _);
  }
]);

The initial constant('lodash', null) causes ocLacyLoad to fail when it tries to toString the value at L859.

Things seem to work if I just add a null check in signature (if null, return data), but I haven't tested extensively.

@gustavolira
Copy link

Hi @ocombe I was having the same problem about "No module found during bootstrap, unable to init ocLazyLoad", but after update my oclazyload.js from src folder at github this problems disappeared.
No I'm having another problem, my karma:unit never works if I put ocLazyLoad, there always an error (and don't show or say wich is the error) =/
The only information is this:
PhantomJS 1.9.8 (Linux): Executed 0 of 1 ERROR (0.001 secs / 0 secs)
Warning: Task "karma:unit" failed. Use --force to continue.

@ocombe ocombe closed this as completed in 83d416f Feb 26, 2015
@ocombe
Copy link
Owner

ocombe commented Feb 26, 2015

Ok thanks for the report @tclift, I just pushed a commit to fix this. I will change the way I define signature soon to only keep a hash (because storing the full string of a function consumes too much memory for nothing), but for now it should work !

@ocombe
Copy link
Owner

ocombe commented Feb 26, 2015

@gustavolira check this message, it might help you: #129 (comment)

@tclift
Copy link

tclift commented Feb 27, 2015

Thanks @ocombe, confirming fix and null constants working in 0.6.0.

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

No branches or pull requests

8 participants