No TL;DR Required 🙂
In my previous post I mentioned some of the many differences in Angular 2 from what we have grown used to in Angular 1.x. We covered property binding and how Angular is now binding directly to the DOM Object’s properties, and as a result of this we have been able to get rid of dozens of directives that come out of the box with Angular 1.x.
Some examples of directives we gave were ngShow, ngHref, etc. These old attribute directives were examples of one way and two way binding in Angular 1.x. In Angular 1.x we also have method binding. For this post we will focus on ngClick. In Angular 1.x ngClick is used to associate a function with an event on a DOM element. Continue reading
NO TL;DR Required 🙂
Property Binding in Angular 2 Explained
Angular 2 is full of drastic changes from what Angular 1.x developers have come to know. Fortunately the guys over at Google have put a lot of thought into this and all these changes seem to have very intelligent reasons behind them. The first change I want to talk about and probably the most easy to grasp is Property Binding in Angular 2.
Angular 1.x is filled with out of the box directives that manipulate DOM elements. Some of these you may be familiar with are ngDisable, ngShow, ngHide, ngClass, ngChecked, ngHref, and so on…
By including these attribute directives in your DOM element you can bind to those attributes, gather information, and set information accordingly. What the Angular Team at Google has done with Angular 2 is bind to the elements properties rather than the elements attributes. Continue reading