Home
Ken Dale
Cancel

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 submo...

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) ...

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 tha...

Comparing Angular NgModule and TestBed Side by Side

TestBed’s configureTestingModule method looks similar to NgModule in usage. Check out this side by side example: @NgModule({ | TestBed.configureTestingModule({ ...

2016: Personal Highlights

I posted a personal recap last year, and the year before that. For this year, I’m calling it “2016: Personal Highlights”: I received my first Microsoft MVP award in Visual Studio and Developmen...

Subscribing to Browser Title Changes Using Angular

Angular includes a Title service, which includes getTitle(): string and setTitle(newTitle: string). If you want to keep an in-page header matching the browser title tag, you’ll need something to en...

Angular 2 Services Testing Template

Here’s a simple template for testing Angular 2 services. If the HttpModule portions are uncommented and used, it will make actual wire calls. To use mock calls instead, see Angular 2 MockBackend S...

Angular 2 MockBackend Service Testing Template Using TestBed

Below is a template for using TestBed and MockBackend for mocking Angular 2 HTTP calls. If you want to make actual wire calls, see Angular 2 Services Testing Template instead. import { async, inj...

Angular 2 Component Testing Template Using TestBed

Below is a template for using TestBed to test Angular 2 components. Let me know in the comments if I’ve missed something noteworthy! import { async, TestBed } from '@angular/core/testing'; import...

100% Code Coverage Doesn't Mean It Works

Tests are great. I like testing, tests, and talking about testing and tests. I think code coverage is useful. It can identify gaps in testing, providing a “hey, maybe you should test over here” no...