在ionic 2应用程序中,我有一个包含动态项目的列表。在每个项目中,我都有按钮项目。单击特定按钮项时,将弹出动态警报弹出窗口。一旦我从弹出窗口中选择一个选项,该值将被设置为项目内容。但就我而言,当我从弹出窗口中选择一个值时,它会出现在所有项目中。我想将其设置为唯一选择或单击的项目。请帮我解决这个问题。
HTML代码
<ion-item *ngIf="isGroupShown(i)">
<ion-card-content class="no-left-right-padding card_class">
<ion-row>
<ion-col col-6>
<ion-icon name="card" end (click)="removeItemFromCart(item)"></ion-icon>
<span margin-left class="service-item">{{item.cost}} BD</span>
</ion-col>
<ion-col col-6>
<ion-icon name="clock" end (click)="removeItemFromCart(item)"></ion-icon>
<span margin-left class="service-price">{{item.time | number: '1.0-0'}} Mins</span>
</ion-col>
</ion-row>
</ion-card-content>
<ion-item button class="employee_item" margin-left no-lines (click)="select_emplyee(i)"> {{employee_data||'Select Employee'}}</ion-item>
</ion-item>
.ts代码
select_emplyee(索引){
console.log(index);
let loader1 = this.loadingController.create({
spinner: 'dots',
content: 'Please wait...',
});
loader1.present().then(() => {
this.httpservice.load_single_saloons_employe(this.navParams.get('provider_id')).subscribe(
data => {
console.log(data);
this.Employee_alert = this.atrCtrl.create({});
this.full_employees=data;
console.log(this.full_employees);
this.Employee_alert.setTitle('Select employee..');
for(var i = 0; i < data.length; i++) {
this.emp=data[i];
this.Employee_alert.addInput({
type:'radio',
label: this.emp.member_name,
value: this.emp.id
})
}
this.Employee_alert.addButton({
text: 'Done',
cssClass:'alertCustomCss',
handler: (data) => {
if(data){
console.log(data);
this.employee_data=this.emp.member_name;
// d.textContent = this.employee_data;
}
}
});
this.Employee_alert.setCssClass('alertCustomCss');
this.Employee_alert.present();
loader1.dismiss();
},
err => {
console.log(err);
loader1.dismiss();
},
() => console.log('Movie Search Complete')
);
});
}