注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
myDeferredA = (state) -> deferred = $q.defer() successMsg = 'Success!' errorMsg = 'Error!' setTim... myDeferredA = (state) -> deferred = $q.defer() successMsg = 'Success!' errorMsg = 'Error!' setTimeout( -> $scope.$apply -> if state == 0 deferred.resolve successMsg else deferred.reject errorMsg , 3000) deferred.promise promiseA = myDeferredA(Math.random()*2|0) promiseA.then (msg) -> console.log "success: #{msg}" , (msg) -> console.log "error: #{msg}" 非同期処理の場合Viewの更新が必要になるので、 $scope.$applyの中でdefer
2014/02/27 リンク