【发布时间】:2014-09-03 13:03:15
【问题描述】:
我在缩小时遇到了一些著名的角度问题。
我昨天提交的几个 PR 试图解决这个问题,但这些似乎没有解决问题。
如果在没有缩小的情况下构建,一切都会按预期工作。
当使用缩小构建,但从我的应用模块中删除对“着名.angular”的依赖时, 应用程序优雅地降级为仅 angular,因此布局很糟糕,但底层 angular 应用程序按预期工作,没有错误。
当使用缩小构建时,应用模块依赖于“着名的.angular”, 该应用程序根本无法加载,并出现以下错误:
Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to:
Error: [$injector:modulerr] Failed to instantiate module famous.angular due to:
Error: [$injector:unpr] Unknown provider: t
http://errors.angularjs.org/1.2.23/$injector/u...<omitted>...2)
通过使用this method, 我能够确定哪个函数没有正确缩小, 并触发 Angular 的依赖注入:
function LocationHashbangInHtml5Url(appBase, hashPrefix) { /* ... */ }
这是在核心 Angular 文件中 - angular.js,
它确实在其他情况下正确缩小。
所以我不知道为什么当我在我的应用程序模块中包含“着名的.angular”时,
这引入了错误。
有人知道这里有什么问题吗?
问题演示:
git clone git@github.com:bguiz/browserify-gulp-starter.git
cd browserify-gulp-starter
npm install famous
bower install --save angular angular-route famous-angular
# edit gulpoptions.js
# appName: 'app',
# appFolder: './src-famousangular/app/',
gulp serve-dist
【问题讨论】:
-
是否与本帖有关[this][1] [1]:stackoverflow.com/questions/18782324/…
-
@SridharChidurala 是的,确实与 DI 有关。仅供参考,我在我的应用程序代码上使用ng-annotate。
famous.angular似乎不需要它,因为它的功能被适当地包装了。这是我一直想不通的。 -
从 Sridhar 提供的链接中找到 ng-annotate。
-
@Noypi 我已经在使用 ng-annotate。无论如何,我手头有solved 的问题。原来是著名的角度代码中的一个错误,我刚刚提交了一个补丁。
标签: javascript angularjs famo.us famous-angular