Hi
I am using angular ng-repeat in my table . my table is editable
option , i want validate individual row on click of Save button , i tried
lot of option but couldn't find exact solution . could you please help me
<div class="content c1 margin-left-10">
<form name="modelDataform" id="modelDataform" novalidate=""
class="form-inline">
<table border="1" class="tms-border-grey-1 tms-width-600" >
<tr class ="tms-border-grey-1">
<th class ="tms-border-grey-1
tms-sheader-h8 tms-font-bold tms-background-F4F6FA ">Model Code</th>
<th class="tms-border-grey-1 tms-sheader-h8
tms-font-bold tms-background-F4F6FA ">Cost / Price</th>
<th class="tms-border-grey-1 tms-sheader-h8
tms-font-bold tms-background-F4F6FA ">Plant Source</th>
<th class="tms-border-grey-1 tms-sheader-h8
tms-font-bold tms-background-F4F6FA ">From Phase Code</th>
<th class="tms-border-grey-1 tms-sheader-h8
tms-font-bold tms-background-F4F6FA " >To Phae Code</th>
<th class="tms-border-grey-1 tms-sheader-h8
tms-font-bold tms-background-F4F6FA ">More</th>
</tr>
<tr ng-repeat="modelcntntChange in
modelPhaseChangeList" ng-class-odd="tms-background-e7e9ed" ng-class-even=""
ng-form="modelInnerForm" id="modelcntntChange_{{$index}}">
<td class="tms-border-grey-1"><div><input
ng-model="modelcntntChange.modelcode"
ng-change="loadModelPlant(modelcntntChange)" ng-model-onblur
name="modelcodes_{{$index}}" id="modelcodes" ng-auto-complete
ui-items="modelCodes" ></div></td>
<td class="tms-border-grey-1"><select
name="phasetype" ng-options="pr.code for pr in modelcostPriceTypes"
ng-model="modelcntntChange.costPriceType"
ng-change="onchangeModelCostPriceType(modelcntntChange)"
ng-init="modelcntntChange.costPriceType=modelcostPriceTypes[0]"
ng-required></select></td>
<td class="tms-border-grey-1"><div ><select
name="plant" ng-model="modelcntntChange.plant" ng-options="pl.code for pl
in modelcntntChange.plantCodes"
ng-change="loadModelPhasecode(modelcntntChange)" required ><option value=""
selected="selected">SELECT</option></select></div></td>
<td class="tms-border-grey-1"><div><select
ng-model="modelcntntChange.fromPhaseCode" ng-options="phase.code for phase
in modelcntntChange.fromphasecodeList"
ng-change="changeFromPhaseCode(modelcntntChange)" required><option
value="">SELECT</option></select></div></td>
<td class="tms-border-grey-1"><select
ng-model="modelcntntChange.toPhaseCd" ng-options="phase for phase in
modelcntntChange.toPhasecodes" required ><option
value="">SELECT</option></select></td>
<td class="tms-border-grey-1"><button
ng-click="modelPhaseChangeList.push({modelcode:''})"
ng-model="modelcontentChange" >+</button> <button
ng-click="removemodelcontentchange(modelcntntChange)"
ng-model="modelcontentChange" ng-if='!$first'>-</button></td>
<div class="error"
ng-show="modelInnerForm.plant_{{$index}}.$error.required"> Please Select
All the field</div>
</tr>
</table>
</form>
</div>
$scope.openDialog = function () {
$scope.dialogOpen = true;
var options = {model:true,title:"Reposition Job Description",
buttons:{
Save:function(){
var modelchangeList = [];
var fioActionList =[];
var fiophasechangeList = [];
var ppophaseActionList= [];
var ppophasechangeList = [];
var fipPhaseActionList = [];
angular.forEach($scope.modelPhaseChangeList,function(key,value){
console.log($scope.modelDataform)
if(key.modelcode !='' && key.modelcode
!=='undefined'){
this.push({costPhaseInd:key.costPhaseInd,fromPhaseCodes:key.fromPhaseCodes,pricePhaseInd:key.pricePhaseInd,toPhaseCd:key.toPhaseCd,plantList:key.plantList,modelList:key.modelList})
}
},modelchangeList);
angular.forEach($scope.fiophaseActionList,function(key,value){
if(key.modelcode !=='undefined' &&
key.modelcode !=='' ){
this.push({costPhaseInd:key.costPhaseInd,pricePhaseInd:key.pricePhaseInd,plantList:key.plantList,modelList:key.modelList,accyIncludeTxt
:key.accyIncl,accyExcludeTxt:key.accyExcl,actionTypeId:key.actionType.id,componentCd:key.componentCd,toPhaseCd:key.toPhaseCd})
}
},fioActionList)
angular.forEach($scope.fiophaseChangeList,function(key,value){
console.log(key);
if(key.modelcode !=='undefined' && key.modelcode
!=='' ){
this.push({costPhaseInd:key.costPhaseInd,pricePhaseInd:key.pricePhaseInd,plantList:key.plantList,modelList:key.modelList,componentCd:key.componentCd,toPhaseCd:key.toPhaseCd,fromPhaseCodes:key.fromPhaseCodes})
}
},fiophasechangeList)
angular.forEach($scope.ppophaseActionList,function(key,value){
console.log(key);
if(key.modelcode !=='undefined' && key.modelcode
!=='' ){
this.push({costPhaseInd:key.costPhaseInd,pricePhaseInd:key.pricePhaseInd,plantList:key.plantList,modelList:key.modelList,accyIncludeTxt
:key.accyIncl,accyExcludeTxt:key.accyExcl,actionTypeId:key.actionType.id,componentCd:key.componentCd,toPhaseCd:key.toPhaseCd})
}
},ppophaseActionList)
angular.forEach($scope.ppophaseChangeList,function(key,value){
console.log(key);
if(key.modelcode !=='undefined' && key.modelcode
!=='' ){
this.push({costPhaseInd:key.costPhaseInd,pricePhaseInd:key.pricePhaseInd,plantList:key.plantList,modelList:key.modelList,componentCd:key.componentCd,toPhaseCd:key.toPhaseCd,fromPhaseCodes:key.fromPhaseCodes})
}
},ppophasechangeList);
var saveObj
={distributorId:distributorId,modelYear:$scope.modelYear,code:$scope.code,desc:$scope.desc,modelPhaseChangeList:modelchangeList,fioPhaseActionList:fioActionList,fioPhaseChangeList:fiophasechangeList,ppoPhaseActionList:ppophaseActionList,ppoPhaseChangeList:ppophasechangeList,brandId:brandId,seriesTOs:seriesIds};
var promise =
$http({url:'/pcps/jobs/setup/reposition/',method:'POST',data:saveObj})
promise.success(function(){
alert("success")
})
promise.error(function(){
alert("error")
})
$(this).dialog("close");
},Cancel:function(){
$(this).dialog("close");
}
}
}
jqueryUI.wrapper('#saveDialog','dialog', options);
}
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.