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

Even better ES5 code for Angular 2

  • A couple of weeks ago we wrote about how to write Angular code in ES5 and took a closer look at what annotations and decorators translate to.
  • In order to understand the syntactical improvements in ES5 when building Angular applications, we have to understand what the code looked like before.
  • Angular uses decorators to add meta data to it’s application code, which in TypeScript (or ES7) looks something like this:

    ES5 doesn’t have the concept of annotations or decorators.

  • That’s why the code above translates to something like this, if we’d write it in ES5:

    If this is entirely new to you, you might want to read our article on Angular code in ES5 which gives a more detailed explanation of this code.

  • The ES5 syntax for Angular 2.



Even better ES5 code for Angular by thoughtram


https://twitter.com/
https://twitter.com/intent/tweet/?text=Even%20better%20ES5%20code%20for%20Angular&url=http://blog.thoughtram.io/angular/2015/07/06/even-better-es5-code-for-angular-2.html


Comments are closed, but trackbacks and pingbacks are open.