The fact that the input has name="Tags" is irrelevant.  

selected_item.Tags existed in his object as an array, like,

$scope.selected_item = {
  Tags: [ 'tag1', 'tag2', ... and so on ]
}

hence selected_item.Tags points to the array

On Wednesday, March 19, 2014 7:10:50 AM UTC-6, Michel Morelli wrote:
>
>
> Il giorno 19/mar/2014, alle ore 06:29, Luke Kende 
> <[email protected]<javascript:>> 
> ha scritto:
>
> Ok, so you've got selected_item bound to ng-model and it is an object with 
> a property of Tags that points to an array.  Instead of trying 
> interpolation on the value attribute of the input, make the input use 
> ng-model and update the value when the selected item changes with 
> ng-change.  This is the more "angular way" of doing it.
>
> <select ng-model="selected_item" name="select" id="gallery_list" 
> ng-options="v as v.Title for (k, v) in Items" 
> ng-change="updateTags()"></select>
> <input type="text" name="Tags" ng-model="selectedTags" placeholder="Tag, 
> Tag 2"/>
>
> //in the controller
> $scope.selectedTags = null;
>
> $scope. updateTags = function(){
>   $scope.selectedTags = $scope.selected_item.Tags.join(); //join() 
> creates a comma separated string of values from the array
> }
>
> Hi, can you explain the last line ? 
> I don’t understand  $scope.selected_item.Tags.
>
> Ok for $scope, but “selected_item” is the ng-model of <select> while 
> “Tags” is “name" of “input text”.
>
> Thanks.
>
> M.
>
> --
> Davide Morelli
> [email protected] <javascript:>
>
>
>
>  
>

-- 
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