سؤال

I need to skip the ng-repeat for particular column.

My Code:

<tr ng-repeat="(lunches,price) in lunchTwo">
                    <td>
                      <label class="label_wraptext">{{lunches}}</label>
                    </td>
                    <td class="td_width">
                    </td>
                    <td>
                      <label>{{price}}</label>
                    </td>
                    <td style="padding-left:190px">
                    </td>
                    <td>
                      <select ng-controller="Quantity">
                        <option ng-repeat="key in notSorted(data)" ng-init="value = data[key]">
                          {{key}}
                        </option>
                      </select>
                    </td> 
                  </tr>

I need to avoid binding the 'Select' control for all the rows.

Thanks in Advance, Stephen.L

هل كانت مفيدة؟

المحلول

Suppose if you want to show the select control only for the first row, you can give a check using the index if it is equals ZERO, then show the select box, else not.

Please find the updated code below, check if it works for you.

<tr ng-repeat="(lunches,price) in lunchTwo">
                    <td>
                      <label class="label_wraptext">{{lunches}}</label>
                    </td>
                    <td class="td_width">
                    </td>
                    <td>
                      <label>{{price}}</label>
                    </td>
                    <td style="padding-left:190px">
                    </td>
                    <td>
                      <select ng-controller="Quantity" ng-show="$index==0">
                        <option ng-repeat="key in notSorted(data)" ng-init="value = data[key]">
                          {{key}}
                        </option>
                      </select>
                    </td> 
                  </tr>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top