Created
July 5, 2013 21:36
-
-
Save shicholas/5937417 to your computer and use it in GitHub Desktop.
Gon and AngularJS in a Rails 4 App
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
// app/assets/javascripts/controllers/funding.js | |
var FundingCtrl = ['$scope', function($scope) { | |
$scope.funding = gon.funding; | |
} | |
]; |
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
# app/controllers/funding_controller.rb | |
# Only showing the show action here, but this is how I'm passing a serialized Funding to Gon | |
class FundingsController < ApplicationController | |
def show | |
@funding = FundingDecorator.decorate(Funding.find(params[:id])) | |
gon.funding = FundingSerializer.new(@funding) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fwiw because I am using gon, I do not need ng-resource