0
ngresource響應我有一個角功能的CoffeeScript像這樣:angularjs不能分配給範圍
$scope.personalDone = ->
user = angular.copy($scope.user)
saved_user = Api.User.save user
$scope.classroom.user = saved_user
$scope.classroom.user_id = saved_user.id
console.log(saved_user)
console.log($scope.classroom.user)
console.log($scope.classroom.user.id)
console.log($scope.classroom.user_id)
我試圖根據響應的ID更新$ scope.classroom.user_id,但無濟於事。下面是控制檯日誌的結果:
- 資源{last_name的: 「巴金斯」,如first_name 「佛羅多」,ID:123}
- 資源{last_name的: 「巴金斯」,如first_name 「佛羅多」, ID:123}
- 不確定
- 不確定
如何分配該API響應範圍變量?
非常好!奇蹟般有效! –