dimanche 6 septembre 2020

AngularJS (checkbox) - Check if value exists in array of object and output "checked"

I'm new to angularJS...

Here is my problem: I am trying to edit a cars features. I have 2 arrays of objects ($scope.car.features and $scope.features) and i need to verify foreach $scope.features if the feature id exists in $scope.car.fatures.

These are the arrays structure:

$scope.car.features [
  {
   car_id : 1,
   feature_id : 1,
   feature_name : 'Heated Seats'
  },
  ...
]

$scope.features [
  {
   feature_id : 1,
   feature_name : 'Heated Seats'
  },
  ...
]



Aucun commentaire:

Enregistrer un commentaire