SHARE
TWEET

Untitled

a guest Sep 29th, 2016 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function testOne(servicea, serviceb) {
  2.     // body
  3. }
  4.  
  5. Try console.log(testOne.toString()). Angular will use a regex to pull out 'servicea' and 'serviceb' from the paramters.
  6.  
  7. /** Minified
  8. function a(b, c) {
  9.     // Note that b and c are NOT the original paramter names, so toString will not work as expected, since b and c are not services!!
  10.     // body
  11. }
  12. */
  13.  
  14. var testTwoArray = [servicec, serviced, function testTwo(c, d) {
  15.     // c and d refer to servicec, serviced since the array syntax has a higher priority over bare function
  16.     // body
  17. }];
  18.  
  19. app.controller("testOne", testOne)
  20. app.controller("testTwo", testTwoArray) Cheaper to compute since the names are provided, also works in production
  21.  
  22. https://github.com/angular/angular.js/blob/master/src/auto/injector.js#L45
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top