Ben10 Ben10 - 1 year ago 81
AngularJS Question

ng-repeat $index for a form field array (ie add new option)

I have two select fields using

method I was adding (clone) the inputs.

I was two different array to maintain to push and remove the object.
But I need to maintain in single array is possible?

My working fiddle is here My Fiddle

Answer Source

Yes possible, just have $scope.model.campuses = [];only, and have a object for school and campus and push it to the array

  function newCampus() {
        $log.log("Adding a new campus");
        $scope.model.campuses.push({Campus :$scope.model.campus, School :$});


Working fiddle

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download