2016-01-19 25 views
0

我有一個Rails 4應用與這樣的資產文件樹嵌套NG-包括使得AngularJS加載無限

- 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 

所以,如果我不NG-包括_parrots_index_paginator.html.slim_parrots_index.html.slim,但只是插入它的代碼,它工作正常(即使它是inse兩次)。

但是,在上面列出的代碼中留下所有內容會導致無限資產加載。爲什麼?

的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 . 

感謝您的幫助,讓我知道如果你需要更多的代碼。

回答

0

在你的_parrots_index.html.slim例如,您有:

... 
tr ng-include="'ng-views/partials/_parrots_index_paginator.html.slim'" 
... 

難道不應該是包括HTML文件(不.slim)?