我想在我的視圖中遍歷JSON數組,但我只想顯示具有非空字符串值的鍵。如何僅顯示數組中的非空字符串值
design:
{name: "ux", value: "3", $$hashKey: "object:5198"}
{name: "graphic", value: "", $$hashKey: "object:5199"}
{name: "concept", value: "4", $$hashKey: "object:5200"}
{name: "photoshop", value: "", $$hashKey: "object:5201"}
{name: "illustrator", value: "5", $$hashKey: "object:5202"}
{name: "inDesign", value: ""}
{name: "afterEffects", value: ""}
{name: "premierePro", value: "1"}
我怎麼會只得到了數組的按鍵,同時通過遍歷數組,只表明有真正價值的人。
當前的代碼,我有是:
<div class="six columns">
<div ng-repeat="skill in employeeDetails.design | limitTo:5:0 | filter:{value:'! '}">
{{ skill.name | capitalize }} {{ skill.value }}
</div>
</div>
任何幫助,將不勝感激!
只需使用|過濾:{值:'!! '} – Vivz