Building web apps with Rails4 and AngularJS in 15 minutes

An approach for Angular and Rails CRUD

Josh Software - Where Programming is an Art!

While learning AngularJS to make a single page app using Rails4, I found some good videos and blogs. However, I did not find any simple example for CRUD operations that made me easily understand the integration between Rails4 and AngularJS. So in this tutorial post, I explain how to create basic CRUD operation using Rails4 and AngularJS.

Here is my git repository for the complete code Github

Create rails project

Create User model

file db/migrate/[timestamp]_create_users.rb


Create Users controller

Create the CRUD operation in users controller and send JSON response. The code sample is here

Add angular gem

In Gemfile add these two gems.

Setup layout

Adding ng-app and ng-view indicates that we have an AngularJS app in the page.

Create an angular controller

First let’s create a directory for our controllers. You can name it whatever you want.

Now create users_controllers.js file. Here I have used the same naming…

View original post 329 more words