为什么不隐藏元素ng-hide?

时间:2015-04-23 12:31:45

标签: angularjs

如果value为零,我需要隐藏元素。我试过了:

<span ng-hide="currentCount.appointment == 0">{{currentCount.appointment}}</span>

console.log(currentCount.appointment)我看到currentCount.appointment的更改值为零后,为什么span块不会隐藏?

完整代码:

request.success(function () {

$scope.currentCount = CounterNotificationService.setCounterInc('appointment', 'decr');
console.log($scope.currentCount.appointment);
});

2 个答案:

答案 0 :(得分:1)

似乎有效,

{{currentCount.appointment == 0}}

评估为

true

我使用ng-hide和ng-class方法创建了a fiddle

答案 1 :(得分:0)

试试这个:

<span ng-hide="currentCount.appointment == '0'">{{currentCount.appointment}}</span>