我通过api休息接收一个json对象,如果我有地方,我想用ng-show显示象形图 杰森:
{
date:"2016-06-30T01:01:01"
id:2
{place: 54, pol: 1, type: "Inside"}
{place: 54, pol: 1, type: "Inside"}
{place: 54, pol: 1, type: "Inside"}
{place: 54, pol: 1, type: "Inside"}
}
控制器:
$scope.LoadAllSpots = function (){
SpotConfigurationService.GetListSpots(function (datas) {
$scope.CAMs = datas;
console.log(datas);
}, function (datas) {
});
}
directive :
template: '<div>' +
' <div class="titles" ng-class="{true: \'SelectedAccordionStyle\',false:\'\'}[showMe]"><span class="svg_Red_Heading" ng-show ="!CAMs[0].place" > <img class="Svg-PictoRougeHeading" src="/Resources/Common/alerte.svg"/></span> {{title}} <a class="more-less glyphicon glyphicon-plus" ng-class="{true: \'glyphicon glyphicon-minus\', false:\'glyphicon glyphicon-plus\'}[showMe]" data-ng-click="OpenAccordion()"></a><button ng-show ="showMe"> {{loadedFilter | i18n :\'ConfigurationSpotCAMValid\':\'Validate the entry\'}}</button> </div>' +
'<div data-ng-show="showMe" data-ng-transclude=""></div>' +
'</div>',
答案 0 :(得分:0)
您可以检查控制器内部的内容,并在满足条件时为变量赋值
{{1}}