I was using the ngAnnotate and uglifyjs in my project.
When I introduced the sample code into my file, it breaked the page after build.
$titleProvider.documentTitle(function($rootScope) {
return $rootScope.$title ? $rootScope.$title + " - My Application" : "My Application";
});
It took a long time to find the reason before I awared that there is a dependency injection of $rootScope.
So I manually add the annotation for the sample code:
$titleProvider.documentTitle(["$rootScope", function($rootScope) {
return $rootScope.$title ? $rootScope.$title + " - My Application" : "My Application";
}]);
or you can just use the "ngInject" directive:
$titleProvider.documentTitle(function($rootScope) {
"ngInject";
return $rootScope.$title ? $rootScope.$title + " - My Application" : "My Application";
});
it works again!
I was using the ngAnnotate and uglifyjs in my project.
When I introduced the sample code into my file, it breaked the page after build.
It took a long time to find the reason before I awared that there is a dependency injection of $rootScope.
So I manually add the annotation for the sample code:
or you can just use the "ngInject" directive:
it works again!