Understanding dependencies in Angular 2

Codelyzer:

// Codelyzer is a tool great for teams and individuals, which helps you // write consistent code, and discover potential errors. // // It processes your TypeScript, templates, template expressions and // even inline styles! Most rules are inspired by the Angular style guide. // They have a URL associated with them that is going to link to the exact // section in angular.io/styleguide.


Zone.js

This makes the bindings work in Angular 2. The Application subscribes to zone’s onTurnDone event, which, if we do some more digging, calls tick, which actually calls all of the change detectors. So, without zones, we don’t get any change detection, so we don’t get any of the nice UI updates that we’d expect! Why does any of this matter? Well, in Angular 2, we don’t have a $digest like in the original angular, so if we were to do something like this in Angular 2: let marker = new google.maps.Marker({ position: new google.maps.LatLng(1, 1), map: someMap, title: 'Title of a marker' }); marker.addListener('click', () => { this.someProperty = Math.random(); }); Then the UI wouldn’t actually update properly, because someProperty actually is updated outside of Angular’s zone. So we have to include something like this in order to get the correct updates: marker.addListener('click', () => { this.zone.run(() => { this.someProperty = Math.random(); }); }); In other words, zone.run() is kind of like the new $digest().

Source: https://medium.com/@MertzAlertz/what-the-hell-is-zone-js-and-why-is-it-in-my-angular-2-6ff28bcf943e


RxJs

In AngularJs 1 the ng.IHttpService (aka, $http) was based on promises and deferrals. In Angular2 we now rely on RxJS (ReactiveX JS) and the observable pattern.

Source: http://davidpine.net/blog/angular-2-http/


core-js

Core.js provides fundamental JavaScript core langauge extensions, including: Core.extend() method of declaring JavaScript classes using classical object-based (rather than prototype-based) inheritance. Supports reservation of internal variable names in classes, abstract properties and their verification in concrete class declarations, and virtual/final modifiers, again verified at declaration time. Method wrapper to enable invocation of specific methods of object instances (e.g., in response to events). Array manipulation utilities. Memory-efficient wrapper for large / frequently modified associative arrays (in order to work around specific substantial Internet Explorer memory leaks).

Sources:


tslint

TSLint is an extensible static analysis tool that checks TypeScript code for readability, maintainability, and functionality errors.