nateabele/ui-router — pull request #3 by christopherthielen (2014-08-30 20:15:25+00:00)
Title: First pass at resolve

Nate, I'm halfway through this code.

I'm trying to encapsulate the resolve functionality. I added PathElement and Resolvable types. Resolvable is trying to encapsulate one state resolve and the lifecycle around it. It tracks:
- resolve name and resolveFn injectable
- what the resolveFn depends on, (strings: either other resolves or anything else injectable)
- The resolvable's promise, if it has been invoked.
- The unwrapped data from the promise
- invoke status (has the resolveFn been invoked yet)

The resolve function:
- maps param1 `ancestorResolvables` array by name
- removes any resolves that this resolve doesn't depend on
- invokes any dependency resolveFn that haven't been invoked yet (I did this to handle your comment in #2)
- waits for all the dependencies's promises to be resolved, then
- unwraps the dependencies promises and calls them `locals`
- invokes the current Resolvable's resolveFn with the locals