Recently, we've been migrating a large (and still in progress) Angular 1.x application from JavaScript to TypeScript. This has allowed us to seriously clean up our code, enforce some more consistent patterns across teams, and provide compile time validation within our code. As we migrated, we realized that some of our service classes had a large number of dependencies injected into them, from other logic services to validation services to data services. Each of these services also may have many dependencies. While Angular does create these as singletons and cache them, many of them may only be used for one or two logic methods so it made sense to use a factory and instantiate them lazily. To accomplish this, I created a couple of helpers. Here's how I did it. More...
In this post I'm going to show you how to build and use re-usable components with shared data in Angular 1.x. While there are similarities to the new component system build into Angular 2.0 Angular 1.5, my component is a completely separate entity and, in my opinion, more robust in most ways. More...