Personally, I just put the data into a regular array rather than return
from a function call. Then in the parent scope, I can do stuff like
$http(get data).then((function(data){$scope.selectOptions.push(data)} or
whatever.

Then in the select itself, you just do an <option ng-repeat="item in
selectOptions" value="{{item.Id}}">{{item.Title}}</option> and so forth. If
you declare the comboBoxDirective, just put a comboOptions: '=' in the
scope instead of an & declaration. Then the options list will automagically
track the values in comboOptions.

e


On Thu, Jun 12, 2014 at 7:40 AM, Jonathan Matthew Beck <[email protected]>
wrote:

> In jQuery I would of done this:
>
> var myElement = $("#" + elementId);
>
> myElement.empty();
>
> for(var i = 0; i < items.length; i ++) {
>     myElement.append('<option value="' + items[i].Id +'">' +
> items[i].Title + '</option>');
> });
>
> But this page is Angular and is not using element ids. The selects look
> like this, they do not have ids, they have field-name.
>
>
> <select combo-box-directive class="input-small-lri-minier"
> data-ng-model="field.value"
>                         field-title="{{field.title}}"
>                         field-name="{{field.fieldName}}"
> data-ng-change="setSelection()" multiple size="20"
>                         data-ng-options="field.title as field.title for
> field in field.options"></select>
>
> When the select with field-name="abc" has it's data-ng-change method
> launched, and I return data from an oData source (all this is done
> already), how do I update the select with field-name="def" with the results
> using Angular?
>
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to