Angular 2 Observables

Angular 2 Observables

Observables help you manage asynchronous data. Think of it as AJAX for Angular 2. To use observables, Angular utilizes a third-party library called Reactive Extensions (RxJS). Observer pattern Because Javascript is single-threaded, handling async data streams are challenging. We utilize the Event Loop to determine the order...

Dependency Injection in Angular 2 (DI)

Dependency injection is an important aspect of Angular 2. It allows you to keep services in separate files to reduce clutter in your code. In short, it makes your code reusable and less buggy. Angular uses a constructor pattern for each component to implement. Here’s a...

ngModel in Angular 2

In Angular 1.0, two-way binding synced the view to the model and the model to the view. In Angular 2.0 this feature doesn’t come right out of the box, but can be implemented as follows: <div class="form-group"> <label for="name">Name</label> <input type="text" class="form-control" id="name" required [(ngModel)]="model.name" name="name"> </div> This...