javascript - NoMethodError in ProfilesController#show -



javascript - NoMethodError in ProfilesController#show -

i working angular , rails, , can't seem angular application run within of app. working ruby 2.1.1 , rails 4.1

came error today , think close figuring out:

class="snippet-code-html lang-html prettyprint-override">angular.module('waiting', [ 'ngroute', 'ng-rails-csrf', 'templates' ]).config(function ($routeprovider, $locationprovider) { $routeprovider .when('/api/parties/:partiesid', { templateurl: '../templates/wait.html', controller: 'waitctrl' }); $locationprovider.html5mode(true); });

class="snippet-code-html lang-html prettyprint-override">angular.module('waiting') .controller('waitctrl', [ '$scope', '$http', '$timeout', 'partyservice', function ($scope, $http, $timeout, partyservice) { $scope.init = function(){ $scope.partycount = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10+']; $scope.parties = []; $scope.formvisible = false; $scope.alerts = {}; $scope.search = { }; partyservice.fetchparties() .success($scope.partiesreceived) .error($scope.partiesfailed) }; $scope.oscillateform = function(){ $scope.formvisible = !$scope.formvisible }; $scope.partiesreceived = function(response){ for (var = 0; < response.length ; i++) { var each_party = response[i].party var partyobject = { id: each_party.id, name: each_party.name, size: each_party.party_count, phone: each_party.phone } $scope.parties.push(partyobject) } }; $scope.partiesfailed = function(response){ console.log("err"); }; $scope.showall = function(){ $scope.search = {}; }; $scope.addparty = function(isvalid){ if (isvalid) { partyservice.addanotherparty($scope.formdata) .success($scope.partyadded) } else { console.log("problem form mah nigga"); } }; $scope.partyadded = function(response){ console.log(response.party) var partyobject = { id: response.party.id, name: response.party.name, size: response.party.party_count, phone: response.party.phone } $scope.parties.push(partyobject) $scope.formdata = {}; $scope.formvisible = false; $scope.partyform.$setpristine(); }; $scope.deleteallparties = function(){ partyservice.deleteallparties().success($scope.allpartiesdeleted) }; $scope.allpartiesdeleted = function(response){ $scope.parties = []; }; $scope.deleteparty = function(index){ console.log(); $scope.deleteindex = index; var partyid = $scope.parties[index].id partyservice.deleteparty(partyid).success($scope.partydeleted) }; $scope.partydeleted = function(response){ $scope.parties.splice($scope.deleteindex, 1) }; $scope.sendtext = function(index){ $scope.smsindex = index; var partyid = $scope.parties[index].id partyservice.sendtext(partyid).success($scope.textsuccessful).error($scope.textfailed) $scope.parties[index].disable = true; $timeout(function(){ $scope.parties[index].disable = false; }, 10000); }; $scope.textsuccessful = function(response){ $scope.alerts.textsuccesful = true $timeout(function(){ $scope.alerts = {}; }, 4000); }; $scope.textfailed = function(respn){ $scope.alerts.textfailed = true console.log("it failllied"); $timeout(function(){ $scope.alerts = {}; }, 4000); }; $scope.alertsexist = function(){ var keys = object.keys($scope.alerts).length if (keys == 0) { homecoming false } else { homecoming true } }; $scope.init(); }]);

parties_controller.rb class="snippet-code-html lang-html prettyprint-override">class partiescontroller < applicationcontroller respond_to :html, :json, :xml def index @parties = current_business.parties respond_with(@parties) end def create @party = party.create(name: params[:name], party_count: params[:size], phone: params[:phone], user_id: current_business.id) respond_with(@party) end def destroy @party = party.find(params[:id]) @party.destroy render :json => 'success' end def destroy_all party.destroy_all(:business_id => current_business.id) render :json => 'success' end end

below set parties/index.html.erb file see if functionality working:

class="snippet-code-html lang-html prettyprint-override"><div class="container" ng-app="waiting"> {{partyservice}} {{partiesreceived}} </div>

class="snippet-code-html lang-html prettyprint-override"> scope :api, defaults: {format: :json} post '/send_text/:id' => 'send_text#send_text_message' resources :parties '/parties/destroy/all' => 'parties#destroy_all' end

thanks ahead of time help!

class="snippet-code-html lang-html prettyprint-override">class user < activerecord::base mount_uploader :avatar, avataruploader # include default devise modules. others available are: # :confirmable, :lockable, :timeoutable , :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :authentication_keys => [:login] attr_accessor :login validates :username, :uniqueness => { :case_sensitive => false } has_many :statuses has_many :reviews, dependent: :destroy has_many :reservations, dependent: :destroy has_many :purchases, class_name: "order", foreign_key: "buyer_id" def self.find_first_by_auth_conditions(warden_conditions) conditions = warden_conditions.dup if login = conditions.delete(:login) where(conditions).where(["username = :value or lower(email) = lower(:value)", { :value => login }]).first else where(conditions).first end end def full_name if self.name.blank? self.email else self.name end end end

javascript ruby-on-rails ruby angularjs

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -