2014-09-04 69 views

回答

2

永远不要使用jquery的ajax以及angularjs。这使它很难测试。更方便的方式是从https://docs.angularjs.org/api/ng/service/ $ http的$http模块。

所以,你的例子看起来像这样(我假设你发布的内容,不测试和CoffeeScript的不流畅;)):

$http.post("/adwords_tools/keyword_estimates", _.map(keywords, (kw)-> kw.name)).success (response) -> 
    console.log response 
+1

接受这个,因为它是一个很好的最佳实践。 实际问题出在我用于Rails的'rack-mini-profiler'宝石内。看到这个问题:https://github.com/MiniProfiler/ui/pull/13/commits – Hendrik 2014-09-04 13:20:31

相关问题