这里有像这样的物品
"items": [
{
"$id": "2",
"Id": 1,
"Name": "Weight",
"Order": 1,
"IsCalculated": 0,
"parameterValues": [
{
"$id": "3",
"Id": 1,
"Name": "kg",
"Weightage": 2,
"ParameterId": 0
},
{
"$id": "4",
"Id": 2,
"Name": "Tonns",
"Weightage": 5,
"ParameterId": 0
},
{
"$id": "5",
"Id": 3,
"Name": "Brass",
"Weightage": 8,
"ParameterId": 0
}
],
{
"$id": "6",
"Id": 2,
"Name": "Length",
"Order": 2,
"IsCalculated": 0,
"parameterValues": [
{
"$id": "7",
"Id": 4,
"Name": "CM",
"Weightage": 6,
"ParameterId": 0
},
{
"$id": "8",
"Id": 5,
"Name": "Inch",
"Weightage": 9,
"ParameterId": 0
},
{
"$id": "9",
"Id": 6,
"Name": "km",
"Weightage": 7,
"ParameterId": 0
}
],
现在,使用此结果将ng-repeat与主要项目绑定 - 如权重,长度等 它看起来像这个附加图像I need to selected ng-options while edite time和子项绑定ng-options。
我的观看代码就像这样 如果有更好的方法,请建议......谢谢..
<div class="mt-10">
<div class="col-md-4" ng-repeat="param in parameter">
<div class="form-group" ng-class="{ 'has-error' : newLeadForm.{{param.Name.split(' ').join('_')}}.$invalid && !newLeadForm.{{param.Name.split(' ').join('_')}}.$pristine || newLeadForm.{{param.Name.split(' ').join('_')}}.$invalid && submitted, 'has-success' : newLeadForm.{{param.Name.split(' ').join('_')}}.$valid && !newLeadForm.{{param.Name.split(' ').join('_')}}.$pristine || newLeadForm.{{param.Name.split(' ').join('_')}}.$valid && submitted}">
<label for="website">{{param.Name}}: </label>
<select name="{{(param.Name).split(' ').join('_')}}" id="{{(param.Name).split(' ').join('_')}}" ng-model="param.name" ng-options="v as v.Id as v.Name for v in param.parameterValues track by v.Id" ng-change="valuechange(param.Id,param.name)" class="form-control" required>
<option value="">Select Value </option>
</select>
<p class="help-block">
<span ng-show="newLeadForm.{{param.Name.split(' ').join('_')}}.$invalid && !newLeadForm.{{param.Name.split(' ').join('_')}}.$pristine || newLeadForm.{{param.Name.split(' ').join('_')}}.$>Select {{param.Name}}.</span>
</p>
</div>
</div>
</div>