Resolving Blacklisted RxJS Import TSLint Error

When working with Angular and the Angular CLI, one might import an RxJS Observable as: import { Observable } from 'rxjs'; Later, running TSLint reports This import is blacklisted, import a submodule instead. Quick fix To fix the error reported by TSLint, simply change import { Observable } from 'rxjs';... [Read More]

TypeScript Constructor Assignment: public and private Keywords

TypeScript includes a concise way to create and assign a class instance property from a constructor parameter. Rather than: class TestClass { private name: string; constructor(name: string) { = name; } } One can use the private keyword instead: class TestClass { constructor(private name: string) { } } The... [Read More]
Tags: typescript

Run Custom Functionality When Angular Http Errors Occur

Angular includes its own functionality for making HTTP requests. When using it, you may want to react to any errors that happen – perhaps to display an on-screen error message. You can achieve that by extending Http. custom-http.service.ts import { Injectable } from '@angular/core'; import { ConnectionBackend, Http, Request, RequestOptions,... [Read More]
Tags: angular