angular2 syntax notes

Angular 2 Style Guide (Updated – May, 2016)

Learn how to write templates that display data and consume user events with the help of data binding. Angular 2 site (January 2016)

(October 2015) Per Helgevold “As of alpha.40 we no longer need the @View section. Instead we can specify all the attributes in the @component section. I think it’s a great simplification.

From Victor Savkin’s ‘The core concepts of angular2’ post:

“The component is just the most important type of a directive, but not the only one. A component is a directive with a view. But you can still write decorator-style directives, which do not have views.”

Victor Savkin – Angular2 Template syntax (Updated May, 2016)

System.js is a third-party open-source library that adds ES6 module loading functionality to browsers.

Here is how it is used on a sample index.html page to load the app.js code that was created by the transpiler from my app.ts component:


import statements:

import {Component, View, bootstrap} from ‘angular2/angular2’;

The above import statement uses ES6 module syntax to import three symbols from the Angular module. The module will load at runtime.

And from’s A deep dive into Angular 2.0 (7.7.2015): The module loading mechanism from Angular 1.x is gone. What we have instead is an import statement that we can use to cherry-pick which required symbols will be loaded from a specific type definition at runtime.


From Wintellect’s Josh Carroll blog: Pro Tip: bootstrap returns a promise that you can use to log information out to the console in case your application fails to load. It will help with debugging, or even displaying a friendly error message to the user.

The For and If classes were recently renamed NgFor and NgIf. (Summer, 2015)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s