However, it breaks if I set debug="false". In this case the list of companies is not loading, but I also experienced other weird behaviour in other controllers such as resetting the $scope.model to null on trying to update the value and so forth.
I guess it has to do with minification and concatenation which is done to my code.
Has anyone experience something similar? Any tips how to fix it and avoid in the future?
Thanks for sharing this Dan, I've just been caught by it and couldn't for the life of me work out why this worked in test and staging but not in production.
I might look at implementing this npm module for future builds:
I already inject dependencies by wrapping them in the array. $inject has the same effect, it's just a style difference. I tried it but it's the same - still not working in the release mode.
ClientDependency breaks my angularJS custom field editor controller
Hey guys, I have umbraco 7.3.7 and I have this simple angularJS controller for one of my custom field editors:
The editor renders select control and add selected items to list. It works perfectly fine when I have debug set to true in my web.config:
However, it breaks if I set debug="false". In this case the list of companies is not loading, but I also experienced other weird behaviour in other controllers such as resetting the $scope.model to null on trying to update the value and so forth.
I guess it has to do with minification and concatenation which is done to my code.
Has anyone experience something similar? Any tips how to fix it and avoid in the future?
I've had similar issues, though they only occurred with JavaScript that I'd minified manually before it was "compressed" by the Client Dependency.
But there is a way of writing Angular so it's more robust when minified. See:
http://frontendcollisionblog.com/javascript/angularjs/2015/03/31/something-no-one-tells-you-about-minifying-angularjs-controllers-until-its-too-late.html
http://www.codelord.net/2015/11/18/the-deal-with-angular-and-minification/
Thanks for sharing this Dan, I've just been caught by it and couldn't for the life of me work out why this worked in test and staging but not in production.
I might look at implementing this npm module for future builds:
https://github.com/schmod/babel-plugin-angularjs-annotate
Simon
Thanks Dan,
I already inject dependencies by wrapping them in the array. $inject has the same effect, it's just a style difference. I tried it but it's the same - still not working in the release mode.
is working on a reply...