Currently running Umbraco 7.9.2 and I've got an error appearing when I set debug to false. I've seen a couple of posts about this but I can't see the problem with what I've done.
This error is occurring in a custom section which is split into multiple html and js files.
My code is below. I'll be pasting everything in, sorry there's so much of it.
The error displays the following:
Error: Argument 'SizeGuidesManagement' is not a function, got undefined
<form name="sizeGuidesManagementForm"
ng-controller="SizeGuidesManagement as vm"
ng-show="loaded"
val-form-manager>
</form>
The controller which throws the error:
angular.module("umbraco")
.controller("SizeGuidesManagement", function ($scope, sizeGuidesResource, dialogService, notificationsHandler) {
var vm = this;
});
Also, I use Dashboard.config which says to render this view. Can Dashboard.config have spaces in its location? E.g. below:
Yes it can be a real pain to debug these - issues :(
When you set debug to false the client dependency framework is pushing all of your java-script files together into one, which can have unintended consequences, as you get random interference between the scripts.
The best advice I have is to wrap all of your code in a function set the script to strict mode:
(function() {
'use strict';
// your functions and code in here
})();
This will offer some protection from the scripts interfering with each other as all the variables and functions become isolated within the wrapped function - The "use strict" setting will highlight variable errors before code gets to them which will help in the long run.
in terms of getting to the bottom of it, if you are getting the above error in the chrome developer tools. then click on the error and you will get sent to the compressed javascript file (which will be a pain). but if you click on the braces icon at the bottom of the script window.
Chrome will expand it out and it may give you a pointer as to where the problem lies.
Client Dependency - Argument is not a function
Hi All
Currently running Umbraco 7.9.2 and I've got an error appearing when I set debug to false. I've seen a couple of posts about this but I can't see the problem with what I've done.
This error is occurring in a custom section which is split into multiple html and js files.
My code is below. I'll be pasting everything in, sorry there's so much of it.
The error displays the following:
Package.manifest:
The view which calls this:
The controller which throws the error:
Also, I use Dashboard.config which says to render this view. Can Dashboard.config have spaces in its location? E.g. below:
Any help would be appreciated!
Hi Alex,
Yes it can be a real pain to debug these - issues :(
When you set debug to false the client dependency framework is pushing all of your java-script files together into one, which can have unintended consequences, as you get random interference between the scripts.
The best advice I have is to wrap all of your code in a function set the script to strict mode:
This will offer some protection from the scripts interfering with each other as all the variables and functions become isolated within the wrapped function - The "use strict" setting will highlight variable errors before code gets to them which will help in the long run.
in terms of getting to the bottom of it, if you are getting the above error in the chrome developer tools. then click on the error and you will get sent to the compressed javascript file (which will be a pain). but if you click on the braces icon at the bottom of the script window.
Chrome will expand it out and it may give you a pointer as to where the problem lies.
Thanks for the tip Kevin, I didn't know Chrome had an unminifier! I ended up wrapping all my methods in IIFEs but with no luck.
I ended up looking at line 5668 in DependencyHandler and seeing that my controller wasn't being included when hasOwnProperty() was called,
I fixed this issue by removing the space in my folder "Size Guides", then removing the space from package.manifest and Dashboard.config.
Looks like spaces are a no-no. Not sure why there was a space there in the first place! Cheers for the help.
is working on a reply...