Angular: ng-repeat scope - 14410993

http://angularjs.org/

by divyanshu013

HTML

<div ng-controller="MyCtrl">
  <div ng-repeat="item in array">
    <div class="preview">{{item.param}} {{$index}}</div>
  </div>
  <div ng-repeat="item in array">
    <!-- typing here should auto update it's preview above -->
    <input ng-model="form.name[item.param]" />
    <!-- many other fields here that will also affect the preview -->
  </div>
</div>

JavaScript

var myApp = angular.module('myApp', []);

//myApp.directive('myDirective', function() {});
//myApp.factory('myService', function() {});

function MyCtrl($scope) {
  $scope.array = [{
    param: 'color'
  }, {
    param: 'weight'
  }];

  $scope.form = {

    name: {
      color: 'value of color',
      weight: 'value of weight'
    }

  }
}