Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails can't include AngularJS

I'm following this tutorial and although adding it to the Gem file and bundle installing it works fine. The moment I try to include it into application.js, the file, I get the following error while loading it:

throw Error("Sprockets::FileNotFound: couldn't find file 'angular'\n  (in /my/path/to/rails/app/assets/javascripts/application.js:13)")

application.js file looks like so (starting with line 13):

//= require angular
//= require jquery
//= require jquery_ujs
//= require jquery.ui.autocomplete
//= require bootstrap
//= require pusher.min.js
//= require pusher_setup
//= require_directory .

Therefore, my question is how can I successfully include AngularJS into my Rails project?

I'm currently using Rails 3.2.2, and Ruby 1.9.3.

like image 701
Hengjie Avatar asked Jul 02 '12 08:07

Hengjie


1 Answers

I had face same problem. I resolved it by following way.

1) In my case, //= require_tree . was missing in application.js file.. so i have added it.

2) Restarted Apache Server (If webrick, then restart it)

like image 174
GBD Avatar answered Sep 30 '22 21:09

GBD