I have a fairly simple Angular application that runs just fine on my dev machine, but is failing with this error message (in the browser console) after I deploy it:
Uncaught Error: [$injector:unpr] http://errors.angularjs.org/undefined/$injector/unpr?p0=tProvider%20%3C-%20t%20%3C-%20%24http%20%3C-%20%24compile
No other message besides that. It happens when the page first loads.
I'm running ASP.NET MVC5, Angular 1.2RC3, and pushing to Azure via git.
Googling hasn't turned up anything interesting.
Any suggestions?
EDIT:
I'm using TypeScript, and defining my dependencies with the $inject
variable, e.g.:
export class DashboardCtrl {
public static $inject = [
'$scope',
'$location',
'dashboardStorage'
];
constructor(
private $scope: IDashboardScope,
private $location: ng.ILocationService,
private storage: IDashboardStorage) {
}
}
I believe that should (or is intended to) get around the local variable renaming problems that arise during minification and that can cause this error.
That said, it clearly has something to do with the minification process, as when I set BundleTable.EnableOptimizations = true
on my dev machine, I can reproduce it.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…