Closed lukemcfarlane closed 10 years ago
I have the same issue. I kind of expected that using either just build/ngForceWithRequirements.min.js , or rather (preferred, since used elsewhere in the site) loading in order: lodash.underscore.js, restangular.js, safeApply.js, ngForce.js
but both of these throw the same injector/modulerr error as luke.
documentation mentions nothing about what all these other js files are for. is it like luke is suggesting, that we need to load these other files out of jsSrc folder? or is there something wrong with just using the ngForceWithRequirements.js to get the solution to work in angular?
please advise
Marco,
I just pushed a new version two days ago that fixes the provider issues.
i’ll be updating the documentation as I have time today.
Essentially, There’s a bug in the grunt file where it’s not concatenating in the rectangular, lodash and safeApply files.
IN the meantime, loading them in the order you have listed, along with using the newest codebase (as of 30 seconds ago) should have you up and running
-- Kevin Poorman Sent with Airmail
From: marco comparato notifications@github.com Reply: noeticpenguin/ngForce reply@reply.github.com> Date: August 28, 2014 at 2:44:18 PM To: noeticpenguin/ngForce ngforce@noreply.github.com> Subject: Re: [ngForce] Providers causing module error (#20)
I have the same issue. I kind of expected that using either just build/ngForceWithRequirements.min.js , or rather (preferred, since used elsewhere in the site) loading in order: lodash.underscore.js, restangular.js, safeApply.js, ngForce.js
but both of these throw the same injector/modulerr error as luke.
documentation mentions nothing about what all these other js files are for. is it like luke is suggesting, that we need to load these other files out of jsSrc folder? or is there something wrong with just using the ngForceWithRequirements.js to get the solution to work in angular?
please advise
— Reply to this email directly or view it on GitHub.
great! thanks alot for the support
Are you sure that you pushed your latest changes to the build releases? (showing days ago, and not recent as you are saying) looking at the repo shows only the 'src' folder having been updated today, and the issue is still persistent when using . could you please confirm updating of the release minified files or the jsSrc files? thank you --marco
@marcocom I did update the jsSrc files ~2 days ago, and the tests in src/classes ~ day ago.
I just verified that the only change between whats in master/build/*.js and what I have locally after rebuilding is the date stamp at the top. Can you post the exact error you're having ? maybe a screen shot ?
Well sure. My issue seems to be exactly what Luke described, where as if I try to load the files as documented (ie: 3 dependants and ngForce.min.js) i get an error. images below: but i get this error when listing 'ngForce' as a dependancy to my application:
Alternatively, when i load individual files from the 'jsSrc' folder, all of them like the image below: I get this error:
However, like Luke, if I omit all of the 3 files he mentioned like so:
I get no error. but of course, I hit issues when depending on the 'vfr' service in my controllers, naturally.
Thank you for your help. What am I doing wrong or misunderstanding here? --marco
@marcocom
Here's the loading order I'm using:
<!-- NON-Angular js libraries -->
<script type="text/javascript" src="https://localhost:8000/resources/lib/jquery-2.1.1.js"/>
<script type="text/javascript" src="https://localhost:8000/resources/lib/lodash.underscore.min.js"/>
<script type="text/javascript" src="https://localhost:8000/resources/lib/queryParams.js"/>
<!-- ANGULAR -->
<script type="text/javascript" src="https://localhost:8000/resources/ng/angular.js"/>
<script type="text/javascript" src="https://localhost:8000/resources/ng/angular-loader.js"/>
<script type="text/javascript" src="https://localhost:8000/resources/ng/angular-messages.js"/>
<script type="text/javascript" src="https://localhost:8000/resources/ng/angular-sanitize.js"/>
<script type="text/javascript" src="https://localhost:8000/resources/ng/angular-animate.js"/>
<!-- Third Party Angular Modules -->
<script type="text/javascript" src="https://localhost:8000/resources/lib/angular-growl.js"/>
<script type="text/javascript" src="https://localhost:8000/resources/lib/angular-ui-router.js"/>
<script type="text/javascript" src="https://localhost:8000/resources/lib/ladda.min.js"/>
<script type="text/javascript" src="https://localhost:8000/resources/lib/ui-bootstrap-tpls-0.11.0.js"/>
<script type="text/javascript" src="https://localhost:8000/resources/lib/ui-utils.js"/>
<script type="text/javascript" src="https://localhost:8000/resources/lib/safeApply.min.js"/>
<script type="text/javascript" src="https://localhost:8000/resources/lib/restangular.js"/>
<!-- ngForce -->
<script type="text/javascript" src="https://localhost:8000/resources/ngforce/ngForce.js"/>
<script type="text/javascript" src="https://localhost:8000/resources/ngforce/ngForce-multipart.js"/>
<script type="text/javascript" src="https://localhost:8000/resources/ngforce/ngForce-visualForceRemoting.js"/>
<script type="text/javascript" src="https://localhost:8000/resources/ngforce/ngForce-sfrquery.js"/>
<script type="text/javascript" src="https://localhost:8000/resources/ngforce/ngForce-sfrfile.js"/>
<script type="text/javascript" src="https://localhost:8000/resources/ngforce/ngForce-sfrBackend.js"/>
<script type="text/javascript" src="https://localhost:8000/resources/ngforce/ngForce-sfrAnalytics.js"/>
<script type="text/javascript" src="https://localhost:8000/resources/ngforce/ngForce-sfr.js"/>
<script type="text/javascript" src="https://localhost:8000/resources/ngforce/ngForce-sfTemplate.js"/>
<script type="text/javascript" src="https://localhost:8000/resources/ngforce/ngForce-remoteObjects.js"/>
<script type="text/javascript" src="https://localhost:8000/resources/ngforce/ngForce-encodedUriQuery.js"/>
<!-- Your Application Module Files -->
hmm thats interesting. I suppose I was loading all the angular sub-dependants like angular-loader etc, after your scripts. maybe thats my issue there. Ill try and emulate what you have more precisely and report back. thanks for this --marco
Well, this didnt help me :(
why do you have different filenames than the repo and in oddly different order? (ie: ngForce-multipart.js is not in the repo, but there is a multipart.js in the 'lib' folder, and its loaded after ngForce, although its listed as a dependancy for that module)
I upgraded angular to 1.3 beta (since you are seemingly using it, having an external dependancy on angular-messages) which thankfully didnt hurt my application. I then downloaded all the third-party libraries you are using (was that even neccesary? growl and ladda and ui-bootstrap? i was using standard bootstrap v3.2 prior. ). and do i need to use angular-ui-router.min.js instead of the angular-router.js that comes with the angular build (and that I am already using extensively)?
I have no idea what 'queryParams.js' is and could not find it anywhere on the web. can you explain that?
once again, when i comment out the three jsSrc files (vfr, sftemplates, remoteobjects), I get past run-time errors when loading ngForce as a dependency.
Why do you provide anything in the 'build' folder, minified for release, if that doesnt work to simply load and then depend on as a module?
Im sorry if i seem aggravated, but I have lost 3 days trying to get this library, which my client insists on, to just load. this all seems needlessly complicated and alot of more than just a 'library' that i can use for salesforce queries.
is there perhaps a there a more simple alternative library/module you might recommend? when i look from developer.salesforce.com , i see tons of different releases for mobile, jquery, etc. I just like how this could be used with my angular build, as is, and also alot of the other releases seem years older.
thank you for your help --marco
@marco,
I provide the build folder so that, when I fix the build bug, there’ll be a single file to include that has ngforce and it’s dependencies.
I’m sorry this js causing so much frustration.
I do have different filenames in the repo due to a merge issue. They once were in lib, now moved to jsSrc.
Those third party libs for growl, ladda etc. they were just included because I copy and pasted my script load order from an actual working app.
queryParams is a js file for the particular project i’m working on.
Would you like to do a screen share? (go2meeting, or join.me or even google hangout?) I can help you get this up and running. As I said, I’m using it in production now.
-- Kevin Poorman Sent with Airmail
From: marco comparato notifications@github.com Reply: noeticpenguin/ngForce reply@reply.github.com> Date: August 29, 2014 at 12:49:42 PM To: noeticpenguin/ngForce ngforce@noreply.github.com> Cc: Kevin Poorman kjp@brightleafsoftware.com> Subject: Re: [ngForce] Providers causing module error (#20)
Well, this didnt help me :(
why do you have different filenames than the repo and in oddly different order? (ie: ngForce-multipart.js is not in the repo, but there is a multipart.js in the 'lib' folder, and its loaded after ngForce, although its listed as a dependancy for that module)
I upgraded angular to 1.3 beta (since you are seemingly using it, having an external dependancy on angular-messages) which thankfully didnt hurt my application. I then downloaded all the third-party libraries you are using (was that even neccesary? growl and ladda and ui-bootstrap? i was using standard bootstrap v3.2 prior. ). and do i need to use angular-ui-router.min.js instead of the angular-router.js that comes with the angular build (and that I am already using extensively)?
I have no idea what 'queryParams.js' is and could not find it anywhere on the web. can you explain that?
once again, when i comment out the three jsSrc files (vfr, sftemplates, remoteobjects), I get past run-time errors when loading ngForce as a dependency.
Why do you provide anything in the 'build' folder, minified for release, if that doesnt work to simply load and then depend on as a module?
Im sorry if i seem aggravated, but I have lost 3 days trying to get this library, which my client insists on, to just load. this all seems needlessly complicated and alot of more than just a 'library' that i can use for salesforce queries.
is there perhaps a there a more simple alternative library/module you might recommend? when i look from developer.salesforce.com , i see tons of different releases for mobile, jquery, etc. I just like how this could be used with my angular build, as is, and also alot of the other releases seem years older.
thank you for your help --marco
— Reply to this email directly or view it on GitHub.
@marco,
How are you loading these files? the var jsFiles = [] has me curious.
-- Kevin Poorman Sent with Airmail
From: marco comparato notifications@github.com Reply: noeticpenguin/ngForce reply@reply.github.com> Date: August 29, 2014 at 11:21:10 AM To: noeticpenguin/ngForce ngforce@noreply.github.com> Cc: Kevin Poorman kjp@brightleafsoftware.com> Subject: Re: [ngForce] Providers causing module error (#20)
Well sure. My issue seems to be exactly what Luke described, where as if I try to load the files as documented (ie: 3 dependants and ngForce.min.js) i get an error. images below:
but i get this error when listing 'ngForce' as a dependancy to my application:
Alternatively, when i load individual files from the 'jsSrc' folder, all of them like the image below:
I get this error:
However, like Luke, if I omit all of the 3 files he mentioned like so:
I get no error. but of course, I hit issues when depending on the 'vfr' service in my controllers, naturally.
Thank you for your help. What am I doing wrong or misunderstanding here? --marco
— Reply to this email directly or view it on GitHub.
Its just a simple jquery method for my writing script-tags to the HTML . later when publishing to production, i simply (to avoid issues like you are having, heh) use terminal commands to concantenate all of the listed files and then uglify them into a single compressed JS file.
so: (function($) {
var thisJS = 'loader.js';
var jsFiles = [ // files to be conditionally included
'vendors/lodash.underscore.min.js',
'vendors/angular/angular.min.js',
'vendors/angular-loader/angular-loader.min.js',
'vendors/angular-messages/angular-messages.min.js',
'vendors/angular-sanitize/angular-sanitize.min.js',
'vendors/angular-route/angular-route.min.js',
'vendors/angular-animate/angular-animate.min.js',
(... extra libraries like ngForce, etc)
'app.js',
'shared/services.js',
'shared/filters.js',
'shared/main.js',
'shared/directives.js',
'shared/localize.js',
'shared/Nav.js',
'UI/UICtrl.js',
'UI/UIDirective.js',
'UI/UIService.js',
'Form/FormDirective.js',
'Form/FormCtrl.js',
'Form/FormValidation.js',
'Table/TableCtrl.js',
'UI/Map.js',
'Task/Task.js',
'Chart/ChartCtrl.js',
'Chart/ChartDirective.js',
'Page/PageCtrl.js'
];
if (jsFiles.length > 0) {
$('script').each(function() {
var src = $(this).attr('src');
var i;
if (src && (i = src.indexOf(thisJS, this.length - thisJS.length)) > -1) {
var path = src.substring(0, i);
for (var j = 0, k = jsFiles.length; j < k; j++)
document.write('<script type="text/javascript" src="'+path+jsFiles[j]+'"></script>');
return false;
}
});
}
})(jQuery);
@marcocom
I've just discovered what the issue is. the build process concats and uglifies the files by glob name. In this case, the module's definition is in ngforce.js which, by glob name, is the last file included. I'm finishing up the chagnes to the build script and will repush here in just a second.
@marcocom
I have just pushed a new version to github. Including new minified and unified files.
Loading https://github.com/noeticpenguin/ngForce/blob/master/build/ngForceWithDependencies.min.js should satisfy all dependencies.
nice! thanks for the update --marco
Still getting this error, even with the latest ngForceWithDependencies.min.js
@venorm Faced the same issue till I read the docs again and understood that ngforce.config needs to be injected. Its a part of the deploy bundle.
I seem to get a module error when including any of the following javascript files: lib/ngforce/ngforce-sfTemplate.js lib/ngforce/ngforce-remoteObjects.js lib/ngforce/ngforce-visualForceRemoting.js
It is interesting to note that these three files are providers, whereas the other ones are factories.
The error I am getting is: Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.2.16/$injector/modulerr?p0=leave.requests&p1=…angularjs.org%2F1.2.16%2F%24injector%2Fmodulerr%3Fp0%3DngForce%26p1%3DErro......4)
When I just include build/ngForceWithRequirements.min.js I get the same error message.
When I include all files EXCLUDING the three mentioned above, everything works and runs without a hitch.
Thanks in advance!