Rails在angularjs中给出错误

时间:2015-12-17 12:10:52

标签: ruby-on-rails angularjs

我正在使用rails 4.2.4
宝石文件

gem 'angularjs-rails', '~> 1.4', '>= 1.4.7'
gem 'bootstrap-sass', '~> 3.3.6'


application.js

//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require angular
//= require bootstrap-sprockets
//= require_tree .

application.css.scss

/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any styles
 * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
 * file per style scope.
 *
 *= require_tree .
 *= require_self

 */
 @import "bootstrap-sprockets";
 @import "bootstrap";


我已经通过手动下载这些文件并将其包含在我的javascript文件夹中来安装这些文件 1)angular-datatables.min.js
2)angular-route.min.js
3)jquery.dataTables.min.js
4)routing.js
5)ui-bootstrap-0.14.0.min.js
6)ui-bootstrap-tpls.min.js


我不知道如何解决这个错误实际上我从来没有使用angularjs但我需要包含那些文件。我的错误是

TypeError: Cannot read property 'serverSide' of undefined
    at Object.f [as fromOptions] (angular-datatables.min.self-e164bdf0c2d9000c6262c232dc2dd041f3372c4d835392429a38b0919321ce99.js?bod…:7)
    at angular-datatables.min.self-e164bdf0c2d9000c6262c232dc2dd041f3372c4d835392429a38b0919321ce99.js?bod…:7
    at processQueue (angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:14793)
    at angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:14809
    at Scope.$eval (angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:16053)
    at Scope.$digest (angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:15871)
    at Scope.$apply (angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:16161)
    at bootstrapApply (angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:1680)
    at Object.invoke (angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:4524)
    at doBootstrap (angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:1678)(anonymous function) @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:12521(anonymous function) @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:9293processQueue @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:14801(anonymous function) @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:14809Scope.$eval @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:16053Scope.$digest @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:15871Scope.$apply @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:16161bootstrapApply @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:1680invoke @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:4524doBootstrap @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:1678bootstrap @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:1698angularInit @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:1592(anonymous function) @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:29014fire @ jquery.self-a714331225dda820228db323939889f149aec0127aeb06255646b616ba1ca419.js?body=1:3149self.fireWith @ jquery.self-a714331225dda820228db323939889f149aec0127aeb06255646b616ba1ca419.js?body=1:3261jQuery.extend.ready @ jquery.self-a714331225dda820228db323939889f149aec0127aeb06255646b616ba1ca419.js?body=1:3473completed @ jquery.self-a714331225dda820228db323939889f149aec0127aeb06255646b616ba1ca419.js?body=1:3504
angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:10766 GET http://localhost:3000/devices/js/device.json 404 (Not Found)(anonymous function) @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:10766sendReq @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:10559serverRequest @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:10269processQueue @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:14793(anonymous function) @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:14809Scope.$eval @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:16053Scope.$digest @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:15871Scope.$apply @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:16161bootstrapApply @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:1680invoke @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:4524doBootstrap @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:1678bootstrap @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:1698angularInit @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:1592(anonymous function) @ angular.self-d7c642a2239d433e219a2df47d65f3290d6ec49b679e42a3c8e8099a4a86d8f0.js?body=1:29014fire @ jquery.self-a714331225dda820228db323939889f149aec0127aeb06255646b616ba1ca419.js?body=1:3149self.fireWith @ jquery.self-a714331225dda820228db323939889f149aec0127aeb06255646b616ba1ca419.js?body=1:3261jQuery.extend.ready @ jquery.self-a714331225dda820228db323939889f149aec0127aeb06255646b616ba1ca419.js?body=1:3473completed @ jquery.self-a714331225dda820228db323939889f149aec0127aeb06255646b616ba1ca419.js?body=1:3504

1 个答案:

答案 0 :(得分:0)

您正在angular-datatables之前加载导致该问题的jquery.datatables

您应将下载的文件移至vendor/javascript文件夹,然后按正确顺序加载:

//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require angular
//= require bootstrap-sprockets
//= require jquery.dataTables.min
//= require angular-datatables.min
//= require_tree .