I finally found some videos that talk directly to making an AngularJS site [sic] play nicely with TypeScript (Pluralsight pay-to-play. You can get a free trial, but make sure you select Premium level for your trial or you'll be out of luck). Looks like there was a nice little period where Angular2 had not offiially been released, but TypeScript was already reaonsably mature.
 
So I’m running through the tutorial, and hit the section on Providers. I admittedly hadn’t used them before, and very quickly learned why: Usually you can use a specialized version of a Provider to do what you need, like a Service or Factory. Providers are conventionally used for things that are reused in multiple apps and might need a domain specific tweak as it’s spun up in each specific app's context. 
 
You know, for instance...

Let's say that our unicornLauncher service is so awesome that many apps use it. By default the launcher shoots unicorns into space without any protective shielding. But on some planets the atmosphere is so thick that we must wrap every unicorn in tinfoil before sending it on its intergalactic trip, otherwise they would burn while passing through the atmosphere. It would then be great if we could configure the launcher to use the tinfoil shielding for each launch in apps that need it. We can make it configurable like so...
 

I mean, I'm all for a little humor in a tutorial, but can we get something closer to a real world example for the docs? I mean, I'm not a big fan of PhoneCat app either, since it's just a (now hilariously dated) commercial for Android phones, which is better (?) but so self-serving as to make me wonder. Angular.io's Heroes app is actually pretty close to the right speed.

Honestly, the AngularJS docs in general have left me a little disappointed. Guess in a perfect world, that wouldn't be a problem. Sometimes you gotta know the bugs to ship and which JavaScript frameworks to let die.

Labels: ,