zhuxc 0f80faa4c0 init erp_h5 | 7 years ago | |
---|---|---|
.. | ||
.bower.json | 7 years ago | |
LICENSE.txt | 7 years ago | |
README.md | 7 years ago | |
angular-underscore-module.js | 7 years ago | |
bower.json | 7 years ago |
Make sure you have included underscore.js in your project
<script src="bower_components/underscore/underscore.js">
get it
2. Add angular-underscore-module.js to your main file (index.html)
```<script src="bower_components/angular-underscore-module/angular-underscore-module.js"></script>```
3. Add the module as a dependency in your App definition
```javascript
var myapp = angular.module('MyApp', ['underscore'])
To use, add as an injected dependency to your Controller/Service and it is ready to use
angular.module('MyApp')
.controller('MyCtrl', function ($scope, _) {
...
//Use underscore
_.each(...);
...
References:
Underscore: http://underscorejs.org/ Stackoverflow: http://stackoverflow.com/questions/14968297/use-underscore-inside-controllers Github: https://github.com/andresesfm/angular-underscore-module