0

I have the following array: I get the key's and generate select inputs based on the keys and the options are the values. So in the end I have four select / dropdowns and each with two values.

{
  sku: "401150201025",
  test1: "2,0x1,0",
  test12: "2,5",
  test13: "15,0"
},
{
  sku: "401060120714",
  test1: "1,2x0,7",
  test12: "1,4",
  test13: "6,0"
}  

How can I filter the "sku" key, so that no "sku" select apprears.

  <fieldset class="form-group" ng-repeat="(filterName, values) in availableFilters">
    <label class="pull-left"><% filterName %></label>
    <select class="form-control configurator-radio form-control-lg" ng-model="filter[filterName]">
        <option value="!" selected>Alle</option>
        <option value="<% value %>" ng-repeat="value in values"><% value %></option>
    </select>
  </fieldset>  

This is how I generate the dropdowns.

2 Answers 2

1

Assuming filterName will be 'sku' at one of the iterations inside ng-repeat you can use ng-if to not display it. It won't be added to the DOM at all.

<select ng-if="filterName != 'sku'" class="form-control configurator-radio form-control-lg" ng-model="filter[filterName]">
Sign up to request clarification or add additional context in comments.

Comments

1

Use ng-show or ng-hide

This lets you show something based on a value.

ng-show="value.sku == 'some_sku_value'"

You can also use ng-hide for pretty much the same thing.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.