TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Angular.js directives will break on minification unless you do it like this

8 点作者 ldn_tech_exec1大约 12 年前

3 条评论

michaelw大约 12 年前
There's a better way. Anywhere Angular expects a function it will take an array as well. The array can be the usual list of dependencies and a function.<p>Here's a working version: <a href="http://jsbin.com/onevaz/1/" rel="nofollow">http://jsbin.com/onevaz/1/</a><p>For what it's worth, I agree that the docs need to reflect this.
troygoode大约 12 年前
Can someone explain why this is broken by minification? I'm not seeing it. Something about the parameter names ($scope, $attrs, $element) being re-written by the minifier? Does Angular require them to be named in a certain way?
评论 #5427904 未加载
jgalt212大约 12 年前
Minification is overrated anyway.<p>1. After gzipping, which is done transparently by almost every server/client, the payload size savings from minification really aren't all that compelling. 2. Minification makes debugging your production code harder (digging through minified source) or more laborious (working with a source map). 3. Obfuscating your code runs antithetical to the open nature of the web