Angular.rb example
Tim Bray: If hating this is wrong, I don’t want to be right.
Perhaps you would like this better? :-)
module Angular::X controller :LoginController do @credentials = {username: '', password: ''} def login(credentials) AuthService.login(credentials).then { broadcast! AUTH_EVENTS.loginSuccess }.catch { broadcast! AUTH_EVENTS.loginFailure } end end end
Try it here.
Things to note:
- All dependency injection is taken care of for you
$scope
and$rootScope
are inferred based on context- Input uses Ruby syntax vs JS Syntax
- Generated code is clean, indented, and idiomatic
More examples, from deployed code: roster, agenda.
This will be the covered by my ApacheCon talk.