2014-09-04 74 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

相關問題