2

I have the template:

            <div ng-repeat="CableFilterName in CableFilterNames">

                <fieldset>
                  <legend>{{CableFilterName.filterName}}</legend>
                  <ul id="">
                    <li ng-repeat="filterValue in CableFilterName.filterValues">
                        <input type="checkbox"/> {{filterValue}}
                        <!-- <select> -->
                    </li> 

                  </ul>
                </fieldset>

               </div>

where filterValue in nested ng-repeat has several different values. So question is how to define what is current filterValue-value and depending on it use checkbox or select or any arbitrary HTML ?

UPD:

filterValues = ['Cable System','Electrical', 'Lighting'];
1
  • ng-repeat has several different values, please give ana example of different values Commented Oct 30, 2013 at 19:50

1 Answer 1

3

To have a kind of if statement, you can use the ngSwitch directive in AngularJS :

http://docs.angularjs.org/api/ng.directive:ngSwitch

For example on your ngRepeat loop :

<div ng-switch on="filterValue">
     <div ng-switch-when="value1">//Do what you want when "value1"</div>
     <div ng-switch-when="value2">//Do what you want when "value2"</div>
     ...
     <div ng-switch-default>//Do what you want by default</div>
</div>

I Hope it's what you want, I don't really understand what you try to achieve.

Sign up to request clarification or add additional context in comments.

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.