{"action":"created","issue":{"url":"https://api.github.com/repos/olov/ng-annotate/issues/194","labels_url":"https://api.github.com/repos/olov/ng-annotate/issues/194/labels{/name}","comments_url":"https://api.github.com/repos/olov/ng-annotate/issues/194/comments","events_url":"https://api.github.com/repos/olov/ng-annotate/issues/194/events","html_url":"https://github.com/olov/ng-annotate/issues/194","id":107445752,"number":194,"title":"Documentation of problem annotating function expressions declared at top of coffeescript files","user":{"login":"AJeezy9","id":6742728,"avatar_url":"https://avatars.githubusercontent.com/u/6742728?v=3","gravatar_id":"","url":"https://api.github.com/users/AJeezy9","html_url":"https://github.com/AJeezy9","followers_url":"https://api.github.com/users/AJeezy9/followers","following_url":"https://api.github.com/users/AJeezy9/following{/other_user}","gists_url":"https://api.github.com/users/AJeezy9/gists{/gist_id}","starred_url":"https://api.github.com/users/AJeezy9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AJeezy9/subscriptions","organizations_url":"https://api.github.com/users/AJeezy9/orgs","repos_url":"https://api.github.com/users/AJeezy9/repos","events_url":"https://api.github.com/users/AJeezy9/events{/privacy}","received_events_url":"https://api.github.com/users/AJeezy9/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-21T05:11:14Z","updated_at":"2015-09-21T05:44:30Z","closed_at":"2015-09-21T05:42:32Z","body":"Been racking my brain for the last hour or so trying to find out what was going wrong with minifying an Angular app until I finally discovered that the coffeescript compiler was pushing the `/* @ngInject */` comment above the variable declarations when that comment preceded a function expression at the top of a file, thus preventing ngAnnotate from associating the function with the requested injection. For purposes of clarity, this problem occurs because, when at the top of a file, coffeescript compiles this\r\n\r\n```coffee\r\n### @ngInject ###\r\nmyController = (dependencies...) ->\r\n```\r\nto this\r\n```js\r\n/* @ngInject */\r\nvar myController;\r\nmyController = function(dependencies...) {\r\n\t...\r\n}\r\n```\r\n\r\nUnable to find a workaround, I stumbled onto to the discussion of this problem #152, and I agree that the fault can ultimately be placed at the coffee compiler's feet.\r\n\r\nHowever, being that this is a known issue, can this problem (& those similar to it in other languages) be documented or otherwise noted in a known issues section? \r\n\r\nIt can be hard to discover the reason to why your seemingly annotated & minified app is not working, especially when all you have to go on is otherwise indecipherable AngularJS's error messages.\r\n\r\nAlso, if anyone does have a workaround, I'd love to hear it. Manual injection is so 2012..."},"comment":{"url":"https://api.github.com/repos/olov/ng-annotate/issues/comments/141881507","html_url":"https://github.com/olov/ng-annotate/issues/194#issuecomment-141881507","issue_url":"https://api.github.com/repos/olov/ng-annotate/issues/194","id":141881507,"user":{"login":"olov","id":19247,"avatar_url":"https://avatars.githubusercontent.com/u/19247?v=3","gravatar_id":"","url":"https://api.github.com/users/olov","html_url":"https://github.com/olov","followers_url":"https://api.github.com/users/olov/followers","following_url":"https://api.github.com/users/olov/following{/other_user}","gists_url":"https://api.github.com/users/olov/gists{/gist_id}","starred_url":"https://api.github.com/users/olov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olov/subscriptions","organizations_url":"https://api.github.com/users/olov/orgs","repos_url":"https://api.github.com/users/olov/repos","events_url":"https://api.github.com/users/olov/events{/privacy}","received_events_url":"https://api.github.com/users/olov/received_events","type":"User","site_admin":false},"created_at":"2015-09-21T05:44:30Z","updated_at":"2015-09-21T05:44:30Z","body":"And regarding troubleshooting why your minified code doesn't work in Angular, suspecting a missing DI array, the trick is to use `ng-strict-di` and run ng-annotate on your original (unminified) source."}}