Angular 2 fundamentals

An Angular 2 application is completely split into components. Technically, an Angular 2 component is a reusable custom tag that is mutable and encapsulated with an embedded state, that is, changes to the state or properties will mutate the UI.


Remember that Angular 2 doesn't register the custom tag name as a custom element.

All the components of the application are arranged in a tree structure, with a component as the root node.

Here is an example of how to create a component. It creates a card component that displays an image, title, and description. Place this code in the <script> tag:

var Card = ng.core.Component({ selector: "card", inputs: ["src", "title", "desc"], templateUrl: "templates/card-template.html", styleUrls: ...

Get JavaScript : Moving to ES2015 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.