Category Archives: ES6

Event Binding in Angular 2

Event Binding in Angular 2

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

Property Binding in Angular 2

Property Binding in Angular 2

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

const declarations

const Declarations – Undertstanding ES6

No TL;DR Required 🙂

const Declarations

So the next easy introduction to some ES6 properties are const declarations. const declarations are equivalent to var DONTCHANGEME = "foo" in ES5. When I say equivalent I mean in idea not behavior.

The var syntax and variables created with var can be assigned and re-assigned at any time. In ES6 the “read-only” nature of const declarations is respected and enforced Continue reading

let declarations

let Declarations – Understanding ES6

No TL;DR Required 🙂

I recently got back from attending AngularU in San Francisco. One of the best parts about going to community conferences like this is getting fired up about programming. There was a lot of information that I soaked up while in SF. It also became very clear that there is a lot that I need to learn if I want to keep up with the front end development community. One of those things is Ecma Script 6, ES6, or ES 2015 (it’s being called a lot of things).

So I decided to write blog articles as I start learning different pieces of ES6. This is the first in a series and will be about let declarations. Continue reading