在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">即可判斷,