arrays - Get key names if values is true -
i need keys has value true, , return me key name.
question: need use underscore or can not in simpler way?
{"desenvolvimento": true, "artigos": false, "design": true}
resolved: more simple.
<span ng-repeat="(key, value) in item.tax.categorias" ng-if="value">{{key}}</span>
simply use in loop , test prop!
for(var prop in obj){ if(obj[prop] === true){ // true } }
i encourage read through mdn ways can interact objects , arrays
https://developer.mozilla.org/en-us/docs/web/javascript/reference/statements/for...in
Comments
Post a Comment