I think the answer is in what you said, I just need a little
clarification. The big question is how to send the update message in the
present scope? For example sake, let's say we have select-1 which when
changed updates select-2. These are actually directives, of the same type.
Scope wise, at time of user input:
select-1 calls data-ng-change and I get to the directive function
setSelection().
At this point, scoped to select-1, if I understand correctly, you are
saying to change selectOptions for select-2 and it will automagically (new
Angular keyword :) update. But how do I access selectOptions in the
select-2 directive from select-1?
---
While I was writing this I began to think that if I create another
directive to handle this special type of "associated update select" then I
can create it without affecting anything elsewhere in the project. But
there still remains the issue of sending the update message, and data, from
one to the other.
On Thursday, June 12, 2014 11:20:55 AM UTC-4, Eric Eslinger wrote:
>
> 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]
> <javascript:>> 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] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> 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.