1 回答
TA贡献1789条经验 获得超8个赞
<button id="AddNewField" ng-click="AddNewField();" class="btn btn-success"> Add New </button>
<div ng-repeat="NewField in NewFieldValues">
<div style="width:250px;height:100px;border:1px solid #000;" draggable="true">
<select ng-model="Dynamic.BusinessStep[NewField.ID]" ng-change="BusinessStepChange(NewField.ID,'BusinessStep')" class="form-control">
<option ng-repeat="businessStep in businessSteps" value="{{ businessStep.value }}"> {{ businessStep.text }} </option>
</select>
<br/>
<input type="text" ng-model="Dynamic.ObjectCount[NewField.ID]" ng-blur="BusinessStepChange(NewField.ID,'EventCount')"></input>
</div>
</div>
$scope.NewFieldValues = [];
$scope.FieldID = 0;
$scope.Dynamic = {};
$scope.AddNewField = function(){
item = {};
item["ID"] = $scope.FieldID;
item["Fields"] = [];
$scope.NewFieldValues.push(item);
$scope.FieldID++;
}
$scope.BusinessStepChange = function(BusinessStepID, Type){
for(var bs=0; bs<$scope.NewFieldValues.length; bs++)
{
if($scope.NewFieldValues[bs].ID == BusinessStepID)
{
if(Type == 'BusinessStep')
{
$scope.NewFieldValues[bs]['Fields'].BusinessStep = $scope.Dynamic.BusinessStep[BusinessStepID];
}
else if(Type == 'EventCount')
{
$scope.NewFieldValues[bs]['Fields'].NumberofElement = $scope.Dynamic.ObjectCount[BusinessStepID];
}
console.log($scope.NewFieldValues);
break;
}
}
}
添加回答
举报