Using ionic with rails server

Is there way to use ionic with rails server as a backend?


If you are using Angular, the best way to use your rails backend is through ngResource:$resource

Then you can create a link to the remote resource like this:

var phonecatServices = angular.module('phonecatServices', ['ngResource']);
phonecatServices.factory('Phone', ['$resource',
    return $resource('phones/:phoneId.json', {}, {
      query: {method:'GET', params:{phoneId:'phones'}, isArray:true}
1 Like

thanks max , If I am not using angularjs then what would be the best method to go?

If you are talking about server side, you just need to print json using your server side language. Then ionic can retrieve your json data.

If you want to use Rails for your app backend server you should use rails-api gem. It is a bit more lightweight.

@deepender281190 if you aren’t using Angular, then you’ll want to use the AJAXy features available in your framework of choice. If you are just using something like jQuery, that means using $.ajax.

We really do recommend Angular for Ionic Alpha, because we have used some of the ngAnimate features and other things to make the framework more interactive. Right now the low-level API does not have the same functionality as the Angular portion.

At any rate, you can still use a lot of Ionic without it (like the CSS framework).