我有$scope.count,我想在表中显示特定数据的计数。我做了这个:
$result = $this->_em->createQueryBuilder()
->select('count(u.teamId)')
->from('mypathEntitiesTeams', 'u')
->where('u.teamType =:teamType')
->setParameters(['teamType' => 4 ])
->getQuery()
->getScalarResult();
return $result;
我将其结果保存在$scope.count:中
<label class="btn btn-yellow force-btn">Model = {{ count }} </label>
$scope.count的结果是:
[{"1":"2"}]
不过,我只想显示2。有什么建议吗?
尝试这个
<label class="btn btn-yellow force-btn">Model = {{ count[0]["1"] }} </label>
var resvalue;
$.each(c,function(key,value){
resvalue=value[1]
})