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
Use this:
<% javascript_include_tag 'ng-infinite-scroll.min' %>
Below is the documentation:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.