Consolidate scope variables into $action

Also remove `$actionFailed`, add `$action.error`
I would use a local variable to refer to the state object, to maintain resilience against (reasonable) monkeypatching/etc.