TypeError: object is not a function - fetching collection data using
Angular / rails part2
this is a follow up of this SO TypeError: object is not a function -
fetching collection data using Angular / rails
The goal of this question is to find out how to use angular, typeahead in
rails application on working plunker code....
Wish to understand why the below angular code is working in plunker
code,but when used in rails app, with the same data, there is this error:
TypeError: object is not a function
at Object.source (http://localhost:3000/assets/angular.js?body=1:6300:13)
at getMatchesAsync
(http://localhost:3000/assets/angular-ui-bootstrap.js?body=1:1820:30)
at http://localhost:3000/assets/angular-ui-bootstrap.js?body=1:1871:13
at http://localhost:3000/assets/angular.js?body=1:12030:15
at Array.forEach (native)
at forEach (http://localhost:3000/assets/angular.js?body=1:134:11)
at $setViewValue (http://localhost:3000/assets/angular.js?body=1:12029:5)
at http://localhost:3000/assets/angular.js?body=1:11423:14
at Object.Scope.$eval
(http://localhost:3000/assets/angular.js?body=1:7994:28)
at Object.Scope.$apply
(http://localhost:3000/assets/angular.js?body=1:8074:23
)
class UsersController < ApplicationController
def angular
@users = User.all
render json: @users, only: %w(full_name id)
end
end
resources :users do
collection do
get :angular
end
end
No comments:
Post a Comment