I came up with this DSL like syntax:
The DSL code looks like this (mainly it wraps the kinda ugly generated code):
It is still a bit clunky to use (mainly to get angular’s dependency injection to work) and it is far from completed, but at least a simple controller works!
On the other side you can use this nice functional and composable code in places where I never thought it is possible to get it to work!
The sample project can be found here.