Reputation: 20555
So i have the following ng-repeat
:
<th ng-repeat="field in tableFields" translate="{{field.headerTitle | translate}}"
ts-criteria="{{field.sortable ? field.fieldKey : null}}">
<label class="i-checks" ng-if="field.isCheckbox">
<input type="checkbox" ng-model="checkAll" ng-change="selectAll(checkAll)">
<i></i>
</label>
</th>
This works fine however due to some errors in an external script the ts-criteria
should not be set if field.fieldKey is null
. So my question is how can i remove the attribute completely?
Upvotes: 0
Views: 77
Reputation: 18279
If think a good option would be to use ng-switch
to choose if your attribute should be set, or not.
Don't have your full code, but it would be something like:
<div ng-switch on="myVar">
<th ng-switch-when="true" ts-criteria>ts-criteria here</th>
<th ng-switch-default>not here</th>
</div>
Try it by changing myVar
value.
Upvotes: 2