【发布时间】:2015-04-08 20:05:47
【问题描述】:
我正在从角度服务获取数据
.service('SelectedMemberDetail', function ($http) {
return {
get : function(id) {
return $http.get('/api/members/'+ id);
},
create : function(id) {
return $http.post('/api/members/'+ id);
},
delete : function(id) {
return $http.delete('/api/members/'+ id);
}
}
})
这是调用该服务的控制器函数。
$scope.show = function (user_id) {
$scope.selectedMember = SelectedMemberDetail.get(user_id);
}
我正在尝试像这样在 html 中查看视图
<h2>
<span class="glyphicon glyphicon-user mleft_10 icon_big"></span>
{{ selectedMember.firstName[0] }}
</h2>
<div>
<p class="clear_margin"><b>Address: </b>
{{ selectedMember.address[0] }}
</p>
<p><b>Contact: </b>{{ selectedMember.contact[0] }}</p>
</div>
我查了一下,服务函数返回的是json数据,就是这里,
_id: "552386cb880611101168ab4b"
address: ["pata nai", "text"]
contact: ["23456", "tel"]
email: ["anoop@email", "email"]
firstName: ["Anoop", "text"]
lastName: ["singh", "text"]
我无法在浏览器上看到更新的数据。我的代码有什么问题?
【问题讨论】:
标签: angularjs node.js mongodb express