码迷,mamicode.com
首页 > Web开发 > 详细

js判断map是否为空

时间:2015-09-17 11:33:14      阅读:220      评论:0      收藏:0      [点我收藏+]

标签:

   在HTML页面要判断后台传来的map是否为空,无论有没有内容,在fireBug中始终显示obj{...},  <table class="table table-hover list-table" ng-if="proxyView.clusterStatus==null">或<table class="table table-hover list-table" ng-if="!proxyView.clusterStatus">

<table class="table table-hover list-table" ng-if="proxyView.clusterStatus.length>0">均无法判断,

  最终看到网友的方法感觉很是有效,首先设置一个标志位,并将值设置为true,然后循环遍历这个map,如果进入循环,则说明map非空,在循环中把标志位设置为false,具体代码如下:

proxyView.isempty = true;
for ( var name in cluster ) {
proxyView.isempty = false;
}
然后使用<table class="table table-hover list-table" ng-if="proxyView.isempty">即可判断,

js判断map是否为空

标签:

原文地址:http://www.cnblogs.com/query-Sql/p/4815636.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!