How to setup Angular with Rails
There are a lot of way you can integrate Angular with Rails, a common way is put Angular inside the Asset pipeline. It’s easy to integrate that way but the code base is quite mess at the later point. Recently, I found a way to use Yeomen generator and rails-api to work as front-end and back-end together.
Here’s some Pros and Cons for this way:
Pros:
- Separate struct and codebase for front-end and back-end
- Get rid of unused rails component like erb view template
- No more need to fresh for front-end change
Cons:
- have to deal with csrf token
- need to setup the proxy
- hard to deploy