JavaScript Edu Resources. Angular Courses. React Tutorials. Join us!

Forward references in Angular 2

  • But on the other hand, using regular ES5 constructor functions that would be totally valid because function declarations get hoisted to the top by the JavaScript interpreter behind the scenes.
  • And then, aren’t ES2015 classes just sugar on top of regular ES5 functions after all?
  • But why doesn’t the JavaScript interpreter do that for us in the first place as it does for regular ES5 constructor functions?
  • Now think about what would actually happen if the JavaScript interpreter hoisted just like a regular ES5 constructor function?
  • Ok, now that we understood why classes aren’t hoisted what does that mean for our earlier Angular example where we had to move the to the very top?



Forward references in Angular by thoughtram


https://twitter.com/
https://twitter.com/intent/tweet/?text=Forward%20references%20in%20Angular&url=http://blog.thoughtram.io/angular/2015/09/03/forward-references-in-angular-2.html


Comments are closed, but trackbacks and pingbacks are open.