我正在使用AngularJS,并且我调用了$ resource来获取单个值(例如获取14)。
以下是在我的控制器:
var MaxCount = $resource('/maxquestion/fetch', null,
{
getMaxQuestionCount: {method: 'GET', isArray: false}
});
$scope.maxQuestionCount = MaxCount.getMaxQuestionCount();
现在我想要在控制器中使用$scope.maxQuestionCount
,做$scope.maxQuestionCount[0]
给我1
和$scope.maxQuestionCount[1]
给我4
console.log($scope.maxQuestionCount)
我[object Object]
我There are no child objects
我很困惑。如何访问值14?
感谢您的评论。我一定会考虑这一点,并重写我编写的代码。感谢您的高举。 – LittleLebowski 2013-05-05 13:32:29
@LittleLebowski更新了答案,提供了代码示例 – 2013-05-05 13:36:51
非常感谢!真的很感激它。我已经将其更改为$ http,现在它可以工作。真棒 – LittleLebowski 2013-05-05 13:50:37