This concludes our whirlwind tour of what to do to set up the basics of an
Angular app, powered by Rails. With the setup we've gone through, you can now
crank out features quickly and easily—the hard work has been done.
With that said, I want to leave you with a few design tips, and a basic workflow I've found useful when building Angular apps with Rails.
Because we are “off the Rails”, we have to make more design decisions than we might normally.
- While Angular is supremely flexible, its components do have happy paths - try to stick to those where you can.
- Enforce business rules at the Rails layer always. You don't have to do so in a nice way, but do do it.
It's also useful to have a solid workflow in place.
We saw a few different workflows in this tutorial, but I want to leave with a
workflow I've found effective:
- Create a browser-based test to exercise the expected paths of the UI. This
is largely the “happy path”, but might also include validations and other
exceptional flows that the user will likely experience.
- Write your Angular controller (test-first, of course), which will lead you to fleshing out
what the back-end needs to look like.
- Implement the back-end.
- Implement the view in a basic way to get your browser-based test to pass.
- Add whatever bells-and-whistles or other UI stuff you want, using your
browser-based test to make sure you've haven't broken anything.
With that, go forth and make awesomely rich applications, powered by the best
web framework around!