- Feb 6, 2017
Components are the vital building blocks
When you begin to learn a framework, you should start with one of the most important building blocks, which in case of Angular 2 are components. Angular 1, on the other hand, had controllers and to create a custom element the knowledge of controllers, restrict, controller AS, and directives were prerequisites. This was sort of inappropriate, considering the importance of custom directives to the architecture of Angular apps. You needed to write a lot of code and understand to get to the substance of what exactly you were trying to achieve which, in fact, could be done in less code. Angular 2, whereas, with components as building blocks is quite easier to learn and use and generates almost twenty-five percent less code.
Recommended read – How To Make Your Dot Net Application Secure?
TypeScript makes it a pleasure to use
Data binding is next level
Angular 2 has invented a new syntax for coding especially in property and event binding which makes the framework even more pleasing. In Angular 1 you had to remember the right ng directive in order to bind an image as shown below:
Whereas, in Angular 2 you can just manage it with square brackets as below:
Just remember to wrap the DOM element property that you need to bind to, in square brackets, and it’s done. No need to consult the Angular documentation to look up for the proper ng directive.