0
我是新來的角度,我堅持這個問題,不知道爲什麼會發生這種情況 任何想法都會有所幫助。ReferenceError:結果未定義(Angularjs)
這個定義我的服務:
window.app.factory 'fetchService', ['$http', '$q', '$location', ($http, $q, $location) ->
{
estimate: (newEstimate) ->
def = $q.defer()
$http.post('/v2/delivery_estimates', newEstimate).
then (result) ->
def.resolve result.data
, (result) ->
def.reject result.data
def.promise
}]
這裏window.app映射到angular.module('appName',[...])
這是我的控制器:
window.app.controller 'deliveryCtrl', [ 'fetchService', (fetchService) ->
$scope.setDefaults = ->
{.... few code ....}
fetchService.estimate(initialEstimate)
.then (result) ->
$scope.dWindows = result.delivery_windows
$scope.uWindows = result.unavailable_windows
]
感謝,
感謝
同樣的事情 – rajesh023 2015-02-06 09:44:56