jsFiddle Example: Using Self-Executing Functions with AngularJS Constants
- July 23, 2014 2:31 PM
- AngularJS, Examples & Tutorials, Javascript
- Comments (0)
Properly using Values and Constants in AngularJS can be really powerful, but AngularJS does have one annoyance with Values and Constants: if you want to keep values bundled together (for readability), its hard to have them also reference each other. Self-executing code to the rescue: just build up the value and return it from the function automatically.
Example is base based on the one give at http://michalostruszka.pl/blog/2012/12/23/angular-better-constant-values/