TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

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

8 pointsby ldn_tech_exec1about 12 years ago

3 comments

michaelwabout 12 years ago
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.
troygoodeabout 12 years ago
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 未加载
jgalt212about 12 years ago
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