Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.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
Ruby on rails 无法识别控制器-angularJS_Ruby On Rails_Angularjs_Coffeescript - Fatal编程技术网

Ruby on rails 无法识别控制器-angularJS

Ruby on rails 无法识别控制器-angularJS,ruby-on-rails,angularjs,coffeescript,Ruby On Rails,Angularjs,Coffeescript,我有一个角度控制器 @MyAngular = ($scope) -> $scope.my = [...] @MyAngular.$inject = ["$scope"] 我收到以下消息错误:参数“MyAngular”不是函数,未定义。在我看来,我有%div{“ng controller”=>“MyAngular”} 我找到了一些这样的帖子,但没有任何效果好的,我找到了,我用了一种更干净的方式 app = angular.module "MyApp", [] app.contro

我有一个角度控制器

@MyAngular = ($scope) -> 
    $scope.my = [...]
@MyAngular.$inject = ["$scope"]
我收到以下消息错误:
参数“MyAngular”不是函数,未定义
。在我看来,我有
%div{“ng controller”=>“MyAngular”}


我找到了一些这样的帖子,但没有任何效果

好的,我找到了,我用了一种更干净的方式

app = angular.module "MyApp", []
app.controller 'MyAngular', ['$scope', ($scope) ->
  $scope.my = [...]
]

这是什么语法?@sza这是haml语法,但这不是问题;)AngularJS是javascript。它与rails无关。你能不能在html.haml文件中使用
@sza%div{“ng controller”=>“MyAngular”}完全等同于!好啊我很好奇你使用了太多的框架来实现简单的javascript和html…haml,coffeescript。。。只是为了使用它?