Hello,
I have two objects like below.For example array1/object1 does match with
array2/object1, but the next one array1/object2 seems to match with
array2/object3 in your output. User must select Fruit first after that
choose the color. No need to think about for matches or not. In the end,
each fruit have specific color like my output. how to do it?
var fruits = [{ name: 'apple', selected: true },{ name: 'orange',
selected: false },{ name: 'pear', selected: true },{ name: 'naartjie',
selected: false }];
var color = [
{ name: 'red', selected: true },
{ name: 'green', selected: false },
{ name: 'orange', selected: true },
{ name: 'yellow', selected: false }];
At the view,
<label ng-repeat="fruit in fruits" class="checkbox-inline"><input
type="checkbox" name="selectedFruits[]" value="{{fruitName}}"
ng-model="fruit.selected"> {{fruit.name}}</label><label ng-repeat="color in
colors" class="checkbox-inline"><input type="checkbox" name="selectedColors[]"
value="{{colorName}}" ng-model="color.selected"> {{color.name}}</label>
Output,
[{
"name": "apple",
"color": "red",
"selected": true
},{"name": "orange",
"color": "yellow","selected": true},{"name": "pear",
"color": "green","selected": true}]
Thanks you.
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" 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 https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.