0

I'm making a multistep form and on the first step I have a list of cars with their picture and some radio inputs to select one. On this radio I have a ng-model and the value is the name of the car.

Is it possible to send more information to my model?

I have something like this now:

<li ng-repeat="car in cars">
    <h3>{{car.name}}</h3>
    <input type="radio" name="selected_car" value="{{car.name}}" placeholder="" ng-model="selectedCar.name">
</li>

I'm trying to get something like

<li ng-repeat="car in cars">
    <h3>{{car.name}}</h3>
    <input type="radio" name="selected_car" value="{{car}}" placeholder="" ng-model="selectedCar">
</li>

But when I do that, selectedCar is empty.

  • 1
    You have dot rule issue. http://stackoverflow.com/questions/14049480/what-are-the-nuances-of-scope-prototypal-prototypical-inheritance-in-angularjs , ng-repeat creates a child scope. in your controller do: `$scope.selected = {};` and set ng-model as `selected .car` also use ng-value otherwise it will be a JSON instead of object. – PSL Jun 05 '15 at 19:17
  • Can I use ng-value to do something like {price: 123, month: July} ? – Fernando Claussen Jun 05 '15 at 20:26

0 Answers0