» Posts on Angular 2

Are Your Unit Tests Failing for the Expected Reasons?

Written by Evan Schultz

Unit tests can be an invaluable tool in the developers toolbox. You don't need to be a strict TDD purist to make unit testing worthwhile. Once you get into the flow of writing tests, it can be rather satisfying to watch the Nyan Cat Reporter go across your screen as the number of tests passing increase. As with any other tool though, it can be...

Read More »

Optimize your Angular 2 Application with Tree Shaking

Written by David Barreto

Disclaimer: As commenter Ben Elliot pointed out, the UglifyJs plugin used in the Webpack build is not able to remove unused Typescript classes because those, when transpiled, are implemented using IIFE. The bundle size mentioned in this post is not really reflecting tree shaking but minification. To be able to properly apply tree shaking we need to use a different module loader like Rollup. The...

Read More »

Quick Start with Angular Modules

Written by Evan Schultz

Angular 2 RC5 was released was released last week. Looking through the change log of bug fixes and new features shows a lot of progress has been made. However, I experienced a sinking feeling after reading several pages of Breaking Changes about the introduction of @NgModule and changing how we need to bootstrap our applications. To be fair, the Angular team did a good job...

Read More »

Hijacking Angular 2 Events

Written by Abdella Ali

This post was last updated 08/12/2016. Please refer to our Angular 2 eBook for the most recent updates. One of the nicest changes in Angular 2 is the new template syntax. The declarative nature of the brackets around a property and parentheses around events initially worried many people but it has really grown on me. For example: <myElement (click)=“doSomething($event)”>...

Read More »

Configurable Services in Angular 2

Written by Evan Schultz

This post was last updated 07/28/2016. Please refer to our Angular 2 eBook for the most recent updates. Angular 2 has greatly simplified services since Angular 1. In Angular 1, there was a service, factory, provider, delegate, value, constant, etc. and it wasn't always clear when to use which. For most use cases in Angular 2, services have been greatly simplified. All you...

Read More »