dtyahw
Last Updated: February 25, 2016
·
611
· muszynskis

Ruby on Rails with AngularJS: "Argument [...] is not a function, got undefined"

I have just spent several hours trying to figure out what is wrong with my newly created application.

Error: Argument [...] is not a function, got undefined

It turns out that problem... can be anywhere.

What's wrong?

It usually means we have forgotten about some braces, colons, semicolons, commas, dots etc. In short, there is a syntax error.

But I have been reading my code very carefully and there was no mistake.

What worked for me?

I named my main javascript file main.js. Don't do it.

Name it app.js instead and everything should be fine.

2 Responses
Add your response

20892

After installing angularjs-rails gem. I cant find main.js, and if I create a new file app.js where should I put it?

over 1 year ago ·
20894

I haven't used angularjs-rails gem. However, you should create all your js-related files under app/assets/javascripts folder if it's a typical rails application.

over 1 year ago ·