0

I have a below table

<tr ng-repeat="r in rows">
    <td>{{$index+1}}</td>
    <td>
        <select ng-model="r.selectedObjectRowData"
            ng-options="option.apiName for option in objects"
            class="slds-select box hideOutlineClass" required="required">
                <option value=""></option>
        </select>
    </td>
    <td>
        <select ng-model="r.selectedFieldRowData"
            ng-if="r.selectedObjectRowData"
            ng-options="option.apiName for option in fields"
            class="slds-select box hideOutlineClass" required="required">
                <option value=""></option>
        </select>
    </td>
</tr>

I am trying to prepopulate the select with below data

 rows= [{"selectedValueRowData":"Outbound","selectedOperatorRowData":"Equal To","selectedObjectRowData":"Account","selectedFieldRowData":"Name","id":"xyz","filterLogic":"(1 AND 3) OR 2"}]

I get the last value in the prepopulate data but I cannot get the select drop down to have the values. Can someone tell me how Can I achieve this using angular?

  • I'm new to angular but why is this <option value=""></option> empty? Or that's the piece you are stuck with? – d_k Apr 28 '17 at 2:19
  • Is fields an array of objects where each object has an apiName property? – Keith C Apr 28 '17 at 11:07
  • yes Keith! I figured out the issue I have to use option.apiName as option.fieldLabel for option in objects. and this did the trick. For @d_k it is to show empty default value. – user5129806 Apr 28 '17 at 18:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.