Custom Section, Custom Plugin, Controller is not a function.....
Hello,
I've just created a custom section, but my plugin doesn't seem to work.
When I open my section and click on my TreeNode I get the following error:
angular.min.js?cdv=1901956542:63 Error: Argument 'Scandbio.EditController' is not a function, got undefined
I found a thread on this forum where someone had a similiar issue, the solution there was to make sure the package.manifest file isn't saved with a BOM flag, I've done this and made sure it's saved as UTF-8.
I have to agree with Alex Skrypnyk, this does feel like either a caching issue or there is a bug in your js file. I'd be tempted to remove all the code within the javascript controller and test again. eg. Just have
angular.module("umbraco").controller("Scandbio.EditController", function ($scope, notificationsService, dialogService, assetsService, ecommerceResource) {
alert('hi');
)}
By default, Umbraco will cache the JavaScript and CSS files that you specify in the backoffice. As you write, Umbraco will cache these files pretty hard. There are however a few ways to clear the cache.
As written earlier in this thread, bumping the version name in ~/Config/ClientDepedency.config will force Umbraco to clear it's cache
Recycling the application pool will also clear the cache - eg. if you build a new DLL of your project
In ~/Web.config, you should have a line similar to <compilation defaultLanguage="c#" debug="false" batch="false" targetFramework="4.5" numRecompilesBeforeAppRestart="50"> (here copied from an Umbraco 7.6.4 installation). If you change debug="false" to debug="true", Umbraco will run in debug mode, which regarding packages, will mean that JavaScript and CSS files are no longer bundled and minified by ClientDependency.
This makes it much easier to develop and test your packages (or code in general) locally. However you should then also make sure that your live environment doesn't run in debug mode.
The JavaScript and CSS files (and also your HTML views) may still be cached your browser. If you're using Chrome, you can use it's Developer Tools to get around the caching.
Custom Section, Custom Plugin, Controller is not a function.....
Hello,
I've just created a custom section, but my plugin doesn't seem to work. When I open my section and click on my TreeNode I get the following error:
I found a thread on this forum where someone had a similiar issue, the solution there was to make sure the package.manifest file isn't saved with a BOM flag, I've done this and made sure it's saved as UTF-8.
My package.manifest
edit.html
edit.controller.js
Help me Our.Umbraco-users, you are my only hope
Hi Mathias
Did you clear ClientDependency cache?
Can you remove AppData/TEMP/ClientDependency and AppData/TEMP/PluginCache folders?
Thanks,
Alex
Hello Alex,
I tried what you suggested, but to no effect...
Did you change clientDependency version in the config?
I don't know what you mean, are you referring to this?
ClientDepedency.config
Do I change that version to an arbitrary one?
Yes, change the version to another number.
Didn't work either..
Hey,
Just checking but
Can you check in your browser that your js files are being loaded. eg. Press F12 in Chome, Network tab and press refresh.
Is your package manifest file in the correct place. "/App_Plugins/Scandbio/package.manifest"
Cheers
Yes to both of your questions
So it's not the cache issue, is it right file paths?
Can you try to access js files from browser by direct link ""~/App_Plugins/Scandbio/backoffice/ecommerce/edit.controller.js""?
Sorry, I know it's maybe strange advice.
Yes I can
I have to agree with Alex Skrypnyk, this does feel like either a caching issue or there is a bug in your js file. I'd be tempted to remove all the code within the javascript controller and test again. eg. Just have
I've done just that, here's my updated edit.controller.js
in your code, there is a typo
Same error with typo fixed
Are you using https or http? The same protocol for js and html requests?
HTTP
I gave up :)
I don't blame you :D
I'm starting to think that it's easier just to create a normal, plain MVC Project that implements what I wanted to do in a custom section/plugin.
Thanks for your help though!
Okay... now it works.
I havn't done anything, but now everything works. This is the second time this has happend to me, that the system seems to "repair" itself:
https://our.umbraco.org/forum/using-umbraco-and-getting-started/76521-failed-to-retrieve-data-for-application-tree-merchello
This is one of the most frustrating things about Using Umbraco, it feels like it caches everything it can get it's fithly hands on...
I have NO IDEA what fixed my issue, which is a bigger issue in and of itself. Once again Umbraco has left a bitter taste in my mouth... yay
By default, Umbraco will cache the JavaScript and CSS files that you specify in the backoffice. As you write, Umbraco will cache these files pretty hard. There are however a few ways to clear the cache.
As written earlier in this thread, bumping the version name in
~/Config/ClientDepedency.config
will force Umbraco to clear it's cacheRecycling the application pool will also clear the cache - eg. if you build a new DLL of your project
In
~/Web.config
, you should have a line similar to<compilation defaultLanguage="c#" debug="false" batch="false" targetFramework="4.5" numRecompilesBeforeAppRestart="50">
(here copied from an Umbraco 7.6.4 installation). If you changedebug="false"
todebug="true"
, Umbraco will run in debug mode, which regarding packages, will mean that JavaScript and CSS files are no longer bundled and minified by ClientDependency.This makes it much easier to develop and test your packages (or code in general) locally. However you should then also make sure that your live environment doesn't run in debug mode.
The JavaScript and CSS files (and also your HTML views) may still be cached your browser. If you're using Chrome, you can use it's Developer Tools to get around the caching.
I hope that helps a bit ;)
register if someone gets here too. My case was similar to yours. Unexplainable but after I changed the quotes, it worked
Before:
After
is working on a reply...