This is my code, which works fine:
angular.module('foo', []).config(
function($locationProvider) {
$locationProvider.html5Mode(true);
}
);
However, after minification it looks like this:
angular.module('foo', []).config(function(n) { n.html5Mode(true); });
And AngularJS crashes with some internal exception. I think I understand why it crashes, but what is a workaround?
It is very known and popular issue, you can inject your dependancies in this way
.directive('someDirective', ['$window', function ($window) { .....
You can learn more about it under this link
Another solution is to use ng-anotate
If you use Angular 1.3 you can turn on strictdi
replace this part
.config(
function($locationProvider) {
$locationProvider.html5Mode(true);
}
);
to this
.config(['$locationProvider', function($locationProvider) {
$locationProvider.html5Mode(true);
}
]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With