Ionic $ngResource can't get data from REST server

I am newbie to ionic frame work and while I am testing and modifying ionic sample application I have encountered an error. I use ngResource to get data from rest server. Sample application use node server as rest server and i used CodeIgnitor as REST server. Everything is okey when i use

return $resource('http://localhost:5000/sessions/:sessionId');

it returns :

[{"id":0,"title":"Introduction to Ionic","speaker":"CHRISTOPHE COENRAETS","time":"9:40am","room":"Ballroom A","description":"In this session, you'll learn how to build a native-like mobile application using the Ionic Framework, AngularJS, and Cordova."},{"id":1,"title":"AngularJS in 50 Minutes","speaker":"LISA SMITH","time":"10:10am","room":"Ballroom B","description":"In this session, you'll learn everything you need to know to start building next-gen JavaScript applications using AngularJS."},{"id":2,"title":"Contributing to Apache Cordova","speaker":"JOHN SMITH","time":"11:10am","room":"Ballroom A","description":"In this session, John will tell you all you need to know to start contributing to Apache Cordova and become an Open Source Rock Star."},{"id":3,"title":"Mobile Performance Techniques","speaker":"JESSICA WONG","time":"3:10Pm","room":"Ballroom B","description":"In this session, you will learn performance techniques to speed up your mobile application."},{"id":4,"title":"Building Modular Applications","speaker":"LAURA TAYLOR","time":"2:00pm","room":"Ballroom A","description":"Join Laura to learn different approaches to build modular JavaScript applications."}]

But I got an error when I use my CI REST server although it returns json format as same as node server returns. But also said about CORS errors.I wonder ngResource does not support json format or I don't know what is wrong.

return $resource('http://localhost/tgapp/api/books/user/id/:sessionId');

This is the code to get data from ci rest server.