I have two select fields, I need to filter options in second one based on the selection of the first one, I need to do this by class name. For example these are the select boxes:
<select ng-model="type">
<option val="short">Short</option>
<option val="long">Long</option>
</select>
<select>
<option ng-repeat="item in items" ng-class="{'short': item.short, 'long:' item.long}">{{item.name}}</option>
</select>
The ng-repeat
will generate this kind of HTML:
<select>
<option class="short">Foo</option>
<option class="short long">Bar</option>
<option class="long">Foobar</option>
</select>
When you select short, it should show 'Foo' and 'Bar'. When you select long, it should show 'Foo' and 'Foobar'.
So I want to compare the {{type}} and the applied classnames, and show if one of the applied classnames match the {{type}}. How can I do this?