Angular components

Angular is build up on components.

The starting poing of an Angular app is the bootstrapping of the initial component. Angular runs on a component-tree model. After the first component is loaded it will look in that component HTML view and verifies if it has any nested components. If yes, Angular will find matches and will run the corresponded code.

A component in Angular is used to render a portion of HTML and provide functionality to that portion. It uses a component class where the application logic is added.

For every component in Angular you can specify an HTML template. Angular provides template syntax to wire the templates to DOM events.

Angular 2

Angular – a framework for dynamic web application. It was released in 2011 and it is maintained by Google and open-source community. It helps you organize the HTML, CSS and Javascript code.

Angular 2 is faster that Angular 1.

Angular 2 uses components instead of controlers and scope in Angular 1.

Data binding is more intuitive.

Creating custom directives is more simpler.

Services are now a class.

Other small improvements.

You can use Javascript with Angular 2 but not all browsers support the newest version of Javascript.

Workaround – transpile – write code the code in latest version of Javascript and transpile it into Javascript compatible with all browsers.

  • Babel
  • Typescript – superset of Javascript (including the ES2015 features) developed by Microsoft. It adds type checking and object oriented features.