我有以下jquery代码(从coffee脚本编译)。
(function() {
$(function() {
return $.get('/proteins', function(proteins) {});
});
$.each(proteins, function(index, protein) {
return $('#proteins').append($("<li>").text(protein.name));
});
}).call(this);
生成此代码的coffeescript如下所示:
$ ->
$.get '/proteins', (proteins) ->
$.each proteins, (index, protein) ->
$('#proteins').append $("<li>").text protein.name
我一直得到一个&#34;未捕获的ReferenceError:未定义蛋白质&#34;在我生成的代码的第6行。
我在这里遗漏了什么(非常基本的)?
谢谢!
答案 0 :(得分:0)
在其他位置有一个缩进$ .each和空格的制表符。缩进不正确。使用带有coffeescript支持的编辑器。