Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs angular js文件未在rails应用程序中加载_Angularjs_Ruby On Rails 3 - Fatal编程技术网

Angularjs angular js文件未在rails应用程序中加载

Angularjs angular js文件未在rails应用程序中加载,angularjs,ruby-on-rails-3,Angularjs,Ruby On Rails 3,我在rails中创建了一个应用程序,我编写了一个小的角度示例,我在部分文件中编写并呈现了它。但什么都没有加载。角在部分中起作用吗?我的代码是 <!DOCTYPE html> <html> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <body> <script> var app = a

我在rails中创建了一个应用程序,我编写了一个小的角度示例,我在部分文件中编写并呈现了它。但什么都没有加载。角在部分中起作用吗?我的代码是

<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body>
<script>
var app = angular.module("myShoppingList", []);
app.controller("myCtrl", function($scope) {
    $scope.products = ["Milk", "Bread", "Cheese"];
});
</script>

<div ng-app="myShoppingList" ng-controller="myCtrl">
  <ul>
    <li ng-repeat="x in products">{{x}}</li>
  </ul>
</div>

<p>So far we have made an HTML list based on the items of an array.</p>

</body>
</html>
我在控制台或firebug中没有收到任何错误
有人能提出解决方案吗?

将angular加载到rails视图中没有问题,我可以运行您的示例。您能指定调用分部的位置和方式吗?我将此代码保存在分部文件中,基于选定的菜单项,分部将被呈现。我正在重新定义部分,如“reports/sales_report”%>这似乎没有问题。您是否检查了devtools控制台的js错误?是的。没问题。我使用的是Angular 1.3.14和jQuery3.1.4,这是一个问题吗?或者部分重新定义会有不同吗?我不知道有这样一个不兼容的问题。无论哪种方式,渲染部分都不是您的问题——我复制了上面的代码,将其粘贴到测试rails项目中的部分中,并成功地将其渲染到视图中。我想你没有使用IE8或者更少?
{{x}}
So far we have made an HTML list based on the items of an array.