-
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('myapp.component', ['ngResource']).factory('MyService', function($resource) { | |
return $resource('http://giladmanor.com\\:3000/t/t', {alt: 'json', callback: 'JSON_CALLBACK'}, | |
{ 'send': { method: 'JSONP'}}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApiController < ActionController::Base | |
after_filter :callback_wrapper | |
def send | |
render :json=>{:status=>"ok"} | |
end | |
private | |
def callback_wrapper | |
unless params[:callback].nil? | |
response.body = "#{params[:callback]}(#{response.body});" | |
logger.debug "CALLBACK: \n\n #{response.body.inspect}" | |
end | |
end | |
end |
Your blog is really nice; it has some great information about AngularJS with Rail. Thank you.
ReplyDelete