0
我在這裏要通過商店ID作爲1和0.Here STORE_ID = '1' 是班加羅爾和STORE_ID = '0' 海得拉巴..如何在popover中顯示名稱?
這裏是我的html代碼:
home.ts
presentPopover(myEvent) {
let popover = this.popoverCtrl.create(Popoverpage);
popover.present({
ev: myEvent
});
}
home.html
<ion-header>
<button ion-button icon-only (click)="presentPopover($event)" >
Choose City
<ion-label>{{cityname}}</ion-label>
<ion-icon name="arrow-dropdown" item-right></ion-icon>
</button>
</ion-header>
這裏如果我要點擊「bengaluru」意味着它必須在我的popover中顯示該名稱,並且與「hyderabad」相同。
popoverpage.ts
@Component({
template: `
<ion-list>
<button ion-item (click)="store()">Bengaluru</button>
<button ion-item (click)="fun()">Hyderabad</button>
</ion-list>
`
})
export class Popoverpage{
store_id
cityname
constructor(public viewCtrl: ViewController,
public navCtrl: NavController,
public rest: Rest,
public logger: Logger) {
}
store() {
let storeObj={
store_id: '1'
}
this.logger.debug("checking the " +JSON.stringify(storeObj));
this.rest.post('/store',storeObj)
.subscribe(result => {
this.logger.debug("checking the data "+JSON.stringify(result));
if(result.status == '1'){
this.logger.info("success callback");
this.cityname="Bengaluru";
//this.navCtrl.pop();
this.viewCtrl.dismiss();
}
else{
this.logger.info("error callback");
this.viewCtrl.dismiss();
}
})
}
fun() {
let storeObj={
store_id: '0'
}
this.logger.debug("checking the " +JSON.stringify(storeObj));
this.rest.post('/store',storeObj)
.subscribe(result => {
this.logger.debug("checking the data "+JSON.stringify(result));
if(result.status == '1'){
this.logger.debug("success callback");
this.cityname="Hyderabad";
//this.navCtrl.pop();
this.viewCtrl.dismiss();
}
else{
this.logger.debug("error callback");
this.viewCtrl.dismiss();
}
})
}
}
,如果任何機構都知道,請回復此..
是什麼問題? –
問題是,當我點擊選擇城市,它顯示下拉右下拉下來,如果我點擊bengaluru或海得拉巴它必須顯示該名稱 – balu
在popover意味着選擇城市就像那樣它必須顯示 – balu