angularjs - Filter within ng-repeat -
i have object:
$scope.fields = { id: 'uid', email: 'mail', housenumber: 'det.1', streetone: 'det.2', streettwo: 'det.3', county: 'det.4', postcode: 'det.5', daytimenumber: 'det.6', firstname: 'det.7', lastname: 'det.8', fullname: ['firstname', 'lastname'], address: ['housenumber', 'streetone', 'streettwo', 'county', 'postcode'], mobile: 'det.9', subscribed: 'det.10', yearofbirth: 'det.19', model: 'model', serial: 'serial', purchasedate: 'purchase_date', registrationdate: 'registraition_date' };
and array:
$scope.chosenfields = ['id', 'email', 'fullname', 'postcode', 'subscribed', 'address'];
in html want show keys $scope.fields (e.g. model, serial, purchasedate) not in $scope.chosenfields array. this:
<ul> <li ng-repeat="(key, value) in fields | filter:{checkfields:true}">{{key}}</li> </ul>
and inside checkfields filter, don't call @ all. correct way of doing @ all?
if checkfields
filter, way call
... | checkfields:true
your current code calls angular filter filter
, , passes argument following object
{ checkfields: true }
Comments
Post a Comment