我有一个相当简单的Angular应用程序,它在我的开发机器上运行得很好,但是在我部署之后失败了这个错误消息(在浏览器控制台中):
Uncaught Error: [$injector:unpr] http://errors.angularjs.org/undefined/$injector/unpr?p0=tProvider%20%3C-%20t%20%3C-%20%24http%20%3C-%20%24compile
除此之外没有其他消息。 它会在页面首次加载时发生。
我正在运行ASP.NET MVC5,Angular 1.2RC3,并通过git推送到Azure。
谷歌搜索没有发现任何有趣的东西。
有什么建议?
编辑:
我正在使用TypeScript,并使用$inject
变量定义我的依赖项,例如:
export class DashboardCtrl {
public static $inject = [
'$scope',
'$location',
'dashboardStorage'
];
constructor(
private $scope: IDashboardScope,
private $location: ng.ILocationService,
private storage: IDashboardStorage) {
}
}
我认为应该(或意图)绕过局部变量重命名在缩小期间出现的问题并且可能导致此错误。
也就是说,它显然与缩小过程有关,因为当我在开发机器上设置BundleTable.EnableOptimizations = true
时,我可以重现它。
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: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, eg: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.