Reputation: 495
I am trying to import a file called ng-infinite-scroll.min.js in a html.erb file (titled application.html.erb). I know .erb stands for embedded ruby.
Giving the absolute path to the file like so causes an error:
<script src="/Users/username/Nasiki/app/assets/javascripts/ng-infinite-scroll.min.js"></script>
The error reads out in the console:
"GET http://localhost:3000/Users/username/Nasiki/app/assets/javascripts//ng-infinite-scroll.min.js"
Note that I am running this server locally and so the home for my website is:
http://loclhost:3000
Why can't it find this file given the absolute path. I've tried a lot of different paths, it may have to do with how .erb files accept paths. Does anybody know? Thanks
Upvotes: 0
Views: 1380
Reputation: 1809
Use this:
<% javascript_include_tag 'ng-infinite-scroll.min' %>
Below is the documentation:
Upvotes: 2