Package.Manifest doesn't actually load the javascript files
I see other people have common problems under wierd questions, so to not hijack their threads that may have additional issues and not just the similar problem, heres my question.
As far as I can tell, I've done exactly as the github wiki is saying to do to add an umbraco 7 extension/plugin, added a plugin folder to ~/App_Plugins, in my case: "ActionPicker", then added 3 files;
Now as others have mentioned in their threads, the editor html file gets loaded, and then expects the controller to be there. However it returns, Argument 'ActionPickerController' is not a function, got undefined.
It seems its because this file never got executed. Others on the web have stated its because of some new thing in angular with global functions not being accepted, but even after trying to mend what they say, it still returns the same error, which makes it seem like it simply doesn't inject the controller.
Okay I did further testing, and have come to the conclusion that to me it appears the "javascript" part of the manifest files simply doesn't work.
Alittle hack around this is simply to put in the controller definition in the view file, which of course is not a solution when there needs to be more than 1 of the control on the entire webpage. But as a point that with even the simplest stuff it will work if the file actually loaded.
<script>
function mytester()
{
console.log("Hello from a controller");
}
angular.module('umbraco').controller("mytester", mytester);
</script>
<div ng-controller="mytester"></div>
Will not present the same error, and will actually "work" enough to see that it must be the javascript file(s) simply not being loaded.
Anyone got anything on this? Seems to me other people must have similar problems stopping their big projects, compared to me just playing around?
The way you're doing this should not be necessary - Before your last post how did you then try to trigger the controller? Did you reference it in the view using <div ng-controller="ActionPicker.Controller">View stuff is here</div> ?
Could you please try copy pasting this below code exactly as it is?
angular.module("umbraco").controller("actionPickerController", function(){
console.log('Hello from the controller');
});
View
<div ng-controller="actionPickerController">
<p>Hello from the view</p>
</div>
Also make sure to set the debug attribute in the web.config file to "true" - Otherwise stuff will be cached pretty hard and even though your code is correct you will still see errors because changes are not being picked up. It may also be necessary to clear your browser cache from time to time in order to be sure that new changes take effect.
I've tried a million ways to type it in, the problem is the javascript file isn't being loaded:
'~/App_Plugins/ActionPicker/actionpicker.controller.js' is never being requested, and so the angularjs engine says that the controller doesn't exist.
Also I've tested each file everytime and restarted the server to make sure the files weren't being cached.
The manifest file gets loaded correctly and changes as I make changes to it, no problem. But the javascript files just does not get loaded.
The example I gave in the second post is exactly to show that the problem is that the file never gets requested as I can find it myself, and even if I were to give the js file as the view it would find it fine however not execute it as a script file obviously.
Not quite sure what's going on your machine - But in short, yes they do work. Otherwise people would not be able to release packages etc. based on angularjs etc. :)
What exact version of Umbraco 7 are you using? And what guidelines have you been following? Have you tried reading through the angular workbook? https://github.com/umbraco/AngularWorkbook
Maybe it could help to have a look at how other plugins are made - If you're able to install and run those then your setup should be fine. Then it's just a matter of some syntax that is for some reason not correct I think. - Try downloading https://our.umbraco.org/projects/backoffice-extensions/link-picker and see if it works when you install it. Then try having a close look at the files in the /app_plugins/link picker folder to see how they're setup...perhaps even try copy/pasting then renaming the files to your needs and then remove the code parts you don't need
This is really wierd. I installed another Plugin called "IconPicker" made for version #/, it has both the manifest and the package.xml file as it looks like older versions of umbraco uses. When I stopped my azure server and started it again, it would show up as usually, the manifest gets read and the module gets loaded by angularjs.
Again, javascript file ain't being loaded and the actual datatype doesn't work as it cannot find the controller. -mind you this is a project on this page like the other.
Just to be absolutely sure, I also installed Gibe's Link Picker, and when I stopped and started the server again, so it could be reloaded. Suddenly it loaded both Gibe's and the IconPicker's js file.
If I disable Gibe's again, it will not request IconPicker's js file, and it will again result in an error.
Yeah, I'm doing local tests before I push it up to azure :-( Its the same.
So far, having Gibe's Link thing installed is not really a bad thing anyway, hopefully It will go away if I do a fresh installation and just save my work outside of Umbraco.
If not running in debug mode Umbraco/ClientDependency seems to cache which files should be loaded, so that may be the cause of your problem - that Umbraco doesn't notice a change to the manifest. A quick fix for this is opening and saving Web.config (or something else that will trigger your website to recycle).
Another fix is running Umbraco in debug mode as Dave suggests. This will mean that Umbraco requests each JavaScript file (or stylesheet) individually rather than merging the files using ClientDependency. The files may still be cached in your browser, but you can clear these a bit easier.
If you're using Google Chrome, you can open up the developer console, go to the settings page, and then check "Disable cache (while DevTools is open)". Then the cache will emptied when you make a page reload while also having the developer tools open.
have same issue, have found that it have happened
because manifest file is deserialized in code to an object (JObject)
and mine version contains instead of " -> '
so look like deserializer can't process single quotes.
Package.Manifest doesn't actually load the javascript files
I see other people have common problems under wierd questions, so to not hijack their threads that may have additional issues and not just the similar problem, heres my question.
As far as I can tell, I've done exactly as the github wiki is saying to do to add an umbraco 7 extension/plugin, added a plugin folder to ~/App_Plugins, in my case: "ActionPicker", then added 3 files;
actionpicker.html actionpicker.controller.js package.manifest
My manifest looks like this:
Now as others have mentioned in their threads, the editor html file gets loaded, and then expects the controller to be there. However it returns, Argument 'ActionPickerController' is not a function, got undefined.
It seems its because this file never got executed. Others on the web have stated its because of some new thing in angular with global functions not being accepted, but even after trying to mend what they say, it still returns the same error, which makes it seem like it simply doesn't inject the controller.
Any help? :D
Okay I did further testing, and have come to the conclusion that to me it appears the "javascript" part of the manifest files simply doesn't work.
Alittle hack around this is simply to put in the controller definition in the view file, which of course is not a solution when there needs to be more than 1 of the control on the entire webpage. But as a point that with even the simplest stuff it will work if the file actually loaded.
Will not present the same error, and will actually "work" enough to see that it must be the javascript file(s) simply not being loaded.
Anyone got anything on this? Seems to me other people must have similar problems stopping their big projects, compared to me just playing around?
Hi Jacob
The way you're doing this should not be necessary - Before your last post how did you then try to trigger the controller? Did you reference it in the view using
<div ng-controller="ActionPicker.Controller">View stuff is here</div>
?Could you please try copy pasting this below code exactly as it is?
Package Manifest
Controller
View
Also make sure to set the debug attribute in the web.config file to "true" - Otherwise stuff will be cached pretty hard and even though your code is correct you will still see errors because changes are not being picked up. It may also be necessary to clear your browser cache from time to time in order to be sure that new changes take effect.
Hope this helps!
/Jan
Hi Jan,
Thanks for your reply :-)
I've tried a million ways to type it in, the problem is the javascript file isn't being loaded:
'~/App_Plugins/ActionPicker/actionpicker.controller.js' is never being requested, and so the angularjs engine says that the controller doesn't exist.
Also I've tested each file everytime and restarted the server to make sure the files weren't being cached.
The manifest file gets loaded correctly and changes as I make changes to it, no problem. But the javascript files just does not get loaded.
The example I gave in the second post is exactly to show that the problem is that the file never gets requested as I can find it myself, and even if I were to give the js file as the view it would find it fine however not execute it as a script file obviously.
So to recap, plugins in Umbraco doesn't work or what?
Hi Jacob
Not quite sure what's going on your machine - But in short, yes they do work. Otherwise people would not be able to release packages etc. based on angularjs etc. :)
What exact version of Umbraco 7 are you using? And what guidelines have you been following? Have you tried reading through the angular workbook? https://github.com/umbraco/AngularWorkbook
Maybe it could help to have a look at how other plugins are made - If you're able to install and run those then your setup should be fine. Then it's just a matter of some syntax that is for some reason not correct I think. - Try downloading https://our.umbraco.org/projects/backoffice-extensions/link-picker and see if it works when you install it. Then try having a close look at the files in the /app_plugins/link picker folder to see how they're setup...perhaps even try copy/pasting then renaming the files to your needs and then remove the code parts you don't need
Looking forward to hearing from you.
/Jan
Hi Jan,
Thats what I don't understand :P
Iam using the follow version:
This is really wierd. I installed another Plugin called "IconPicker" made for version #/, it has both the manifest and the package.xml file as it looks like older versions of umbraco uses. When I stopped my azure server and started it again, it would show up as usually, the manifest gets read and the module gets loaded by angularjs.
Again, javascript file ain't being loaded and the actual datatype doesn't work as it cannot find the controller. -mind you this is a project on this page like the other.
Just to be absolutely sure, I also installed Gibe's Link Picker, and when I stopped and started the server again, so it could be reloaded. Suddenly it loaded both Gibe's and the IconPicker's js file.
If I disable Gibe's again, it will not request IconPicker's js file, and it will again result in an error.
Hi Jacob
Hmm, don't know if this can be related to Azure somehow. Do you have a local instance you could try on?
/Jan
Yeah, I'm doing local tests before I push it up to azure :-( Its the same.
So far, having Gibe's Link thing installed is not really a bad thing anyway, hopefully It will go away if I do a fresh installation and just save my work outside of Umbraco.
Are you running in debug mode or not? You can check this in the web.config
The check the attribute debug. If it is set to true it can be a syntax error in your package manifest.
If you are not running in debug try that and see if it works.
Also updating the client dependency cache can help. You need to update attribute in /config/ClientDependency.config
Or try to run your browser with an empty cache.
Dave
A little follow up on the post from Dave.
If not running in debug mode Umbraco/ClientDependency seems to cache which files should be loaded, so that may be the cause of your problem - that Umbraco doesn't notice a change to the manifest. A quick fix for this is opening and saving Web.config (or something else that will trigger your website to recycle).
Another fix is running Umbraco in debug mode as Dave suggests. This will mean that Umbraco requests each JavaScript file (or stylesheet) individually rather than merging the files using ClientDependency. The files may still be cached in your browser, but you can clear these a bit easier.
If you're using Google Chrome, you can open up the developer console, go to the settings page, and then check "Disable cache (while DevTools is open)". Then the cache will emptied when you make a page reload while also having the developer tools open.
Another way for clearing the cache is this Google Chrome plugin - just click a toolbar button, and the cache will be emptied: https://chrome.google.com/webstore/detail/clear-cache/cppjkneekbjaeellbfkmgnhonkkjfpdn
have same issue, have found that it have happened because manifest file is deserialized in code to an object (JObject) and mine version contains instead of " -> ' so look like deserializer can't process single quotes.
I had the same problem, and what helped me was to delete Client Dependency temp files in: \App_Data\TEMP\ClientDependency
Elad
Elad's response saved me a ton of time. Already wasted 2 hours on this in Umbraco 8.10
is working on a reply...