Skip to content

Commit

Permalink
docs(readme): add note about ngmin limitations
Browse files Browse the repository at this point in the history
Add note about what ngmin does not minsafe

Fixes #498
  • Loading branch information
eddiemonge committed Dec 13, 2013
1 parent ba7b505 commit 1203a73
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,24 @@ angular.module('myMod').controller('MyCtrl',

The annotations are important because minified code will rename variables, making it impossible for AngularJS to infer module names based solely on function parameters.

The recommended build process uses `ngmin`, a tool that automatically adds these annotations. However, if you'd rather not use `ngmin`, you have to add these annotations manually yourself.
The recommended build process uses `ngmin`, a tool that automatically adds these annotations. However, if you'd rather not use `ngmin`, you have to add these annotations manually yourself. **One thing to note is that `ngmin` does not produce minsafe code for things that are not main level elements like controller, services, providers, etc.:
```javascript
resolve: {
User: function(myService) {
return MyService();
}
}
```

will need to be manually done like so:
```javascript
resolve: {
User: ['myService', function(myService) {
return MyService();
}]
}
```


### Add to Index
By default, new scripts are added to the index.html file. However, this may not always be suitable. Some use cases:
Expand Down

0 comments on commit 1203a73

Please sign in to comment.