【发布时间】:2016-04-24 23:10:39
【问题描述】:
我有一个带有这样一个 assets 文件树的 Rails 4 应用程序:
- Assets
- - Javascripts
- - - ng-controllers
- - - - parrotsController.coffee
- - - ng-views
- - - - partials
- - - - - _parrots_index.html.slim
- - - - - _parrots_index_paginator.html.slim
- - - - home.html.slim
- - - app.coffee
- - - routes_config.coffee
routes_config.coffee:
...
$routeProvider
.when '/',
templateUrl: 'ng-views/home.html',
controller: 'ParrotsController as vm' # Modern 'as' syntax
# 'vm' goes for ViewModel
.otherwise
redirectTo: '/'
...
home.html.slim:
...
div ng-include="'ng-views/partials/_parrots_index.html'"
...
_parrots_index.html.slim:
...
tr ng-include="'ng-views/partials/_parrots_index_paginator.html.slim'"
...
_parrots_index_paginator.html.slim:
td
| Some content, no models here
所以,如果我不在 _parrots_index.html.slim 中 ng-include _parrots_index_paginator.html.slim 而只是插入它的代码,它可以正常工作(即使插入两次)。
但是,将所有内容保留在上面列出的代码中会导致无限资源加载。为什么?
我的Gemfile:
gem 'jquery-rails'
gem 'angularjs-rails', git: 'https://github.com/ScoutRFP/angularjs-rails' # <- Better fork
gem 'angular-rails-templates'
gem 'angular_rails_csrf'
application.coffee:
#= require jquery
#= require jquery_ujs
#= require bootstrap-sprockets
#= require angular
#= require angular-resource
#= require angular-route
#= require angular-animate
#= require angular-rails-templates
#= require angular-bootstrap/ui-bootstrap-tpls.min
#= require angular-loading-bar
#= require_tree .
感谢您的帮助,如果您需要更多代码,请告诉我。
【问题讨论】:
标签: javascript html ruby-on-rails angularjs coffeescript