javascript - AngularJS Rails 给出空白页面

标签 javascript ruby-on-rails ruby angularjs

我正在关注 thinkster.io/angular-rails 上的教程

到目前为止我已经结束了这个阶段

Integrating the Front-end with the Asset Pipeline

但现在我的应用程序在 Chrome 控制台或 WebRick 控制台上给了我一个空白页面,没有错误

这是我尝试访问 http://localhost:3000/#/home 时看到的内容

Started GET "/" for ::1 at 2015-10-14 18:57:54 -0300
Processing by ApplicationController#angular as HTML
  Rendered layouts/application.html.erb within layouts/application (95.2ms)
Completed 200 OK in 177ms (Views: 176.4ms | ActiveRecord: 0.0ms)


Started GET "/assets/bootstrap/dist/css/bootstrap.css.map" for ::1 at 2015-10-14 18:57:59 -0300

如果我尝试访问http://localhost:3000 ,我在 WebRick 上看到了这一切

Started GET "/" for ::1 at 2015-10-14 19:02:09 -0300
Processing by ApplicationController#angular as HTML
  Rendered layouts/application.html.erb within layouts/application (55.3ms)
Completed 200 OK in 106ms (Views: 105.9ms | ActiveRecord: 0.0ms)


Started GET "/assets/bootstrap/dist/css/bootstrap-b0009f9e25467a0cf98029ba5cea5cc6.css?body=1" for ::1 at 2015-10-14 19:02:09 -0300


Started GET "/assets/application-ebcbb47a1897dc658f254d3ed27f8059.css?body=1" for ::1 at 2015-10-14 19:02:09 -0300


Started GET "/assets/angular/angular-2d5a33d94b093db45bb7a9ede7fb19cd.js?body=1" for ::1 at 2015-10-14 19:02:09 -0300


Started GET "/assets/app-aa9fab9c243b33abeab86ad1957ed641.js?body=1" for ::1 at 2015-10-14 19:02:09 -0300


Started GET "/assets/angular-ui-router/release/angular-ui-router-baa37ca0378f13b403a5dbcdc9aa5155.js?body=1" for ::1 at 2015-10-14 19:02:09 -0300


Started GET "/assets/angular-rails-templates-4c1f2ca110b30578d07f9cc497121e81.js?body=1" for ::1 at 2015-10-14 19:02:09 -0300


Started GET "/assets/home/mainCtrl-b29014101de152dbd6e2c9dc5c28ece7.js?body=1" for ::1 at 2015-10-14 19:02:09 -0300


Started GET "/assets/posts/posts-35d84f25af005d974cc5973c2ef26354.js?body=1" for ::1 at 2015-10-14 19:02:09 -0300


Started GET "/assets/posts/_posts-bc8b8c3f542abacc3b5e9ad028f3cb96.js?body=1" for ::1 at 2015-10-14 19:02:09 -0300


Started GET "/assets/posts/postsCtrl-5ef10d79585a7fc3d40aa58e799fbf70.js?body=1" for ::1 at 2015-10-14 19:02:09 -0300


Started GET "/assets/application-c0bc5d796fa367b0c956d35d8a01fdb4.js?body=1" for ::1 at 2015-10-14 19:02:09 -0300


Started GET "/assets/home/_home-583f0c3e136561b0bb8b62359042f948.js?body=1" for ::1 at 2015-10-14 19:02:09 -0300


Started GET "/assets/bootstrap/dist/css/bootstrap.css.map" for ::1 at 2015-10-14 19:02:09 -0300


Started GET "/assets/application-c0bc5d796fa367b0c956d35d8a01fdb4.js?body=1" for ::1 at 2015-10-14 19:02:09 -0300

你可以在这里查看我的源代码 https://bitbucket.org/federicogiust/flapper-news/src

最佳答案

发现问题了。

我的部分 _home.html 和 _posts.html 中仍然有脚本标记。

我删除了脚本标签,现在工作正常。

关于javascript - AngularJS Rails 给出空白页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33136464/

相关文章:

ruby-on-rails - 为 ActiveRecord 对象上的属性定义 '<<' 方法

ruby-on-rails - Rails 生成 cucumber :install fails with "Could not load generator"

ruby-on-rails - 如何处理 Ruby on Rails 错误 : "Please install the postgresql adapter: ` gem install activerecord-postgresql-adapter'"

javascript - 将单选按钮值传递给 sql 查询

javascript - 为什么 javascript 中的 switch case 不适用于 Microsoft Edge 上的字符串?

php - 使用php将嵌入js加载到页面中以将其隐藏在源代码中?

ruby-on-rails - 使用 nokogiri 更新节点打开 xml 文件并保存

mysql - RoR : Cannot change_column in postgres, 在 MySQL 中正常(MySQL 用于开发,Postgres on Heroku)

php - 用动态语言开发多个页面,但需要输出到静态 HTML 文件?

php - 在动态页面之间传递大字符串值的安全方法