如何在单击从组合框中选择项目时实现事件
How to implement events on the click of selecting of item from combobox
我有一个使用组合框选择类别的页面。当我单击组合框中的任何项目时,我需要在组合框下方获取所选项目的一些描述。
不知道怎么实现。
<ion-header>
<ion-navbar>
<ion-title>REGISTRATION</ion-title>
</ion-navbar>
</ion-header>
<ion-content>
<h1>Step 1 : Choose the category</h1>
<ion-item>
<ion-label>Category</ion-label>
<ion-select [(ngModel)]="category">
<ion-option value="i">Individual</ion-option>
<ion-option value="t">3rd party</ion-option>
<ion-option value="d">Dedicated</ion-option>
</ion-select>
</ion-item>
</ion-content>
<ion-footer no-shadow class="foot">
<ion-toolbar position="bottom">
<button (click)="rg()" ion-button full color="primary" block>Next</button>
</ion-toolbar>
</ion-footer>
import { Component } from '@angular/core';
import { NavController, AlertController, LoadingController, Loading, IonicPage } from 'ionic-angular';
import { ObsAuthService } from '../../services/obs_auth.services';
import { ConnectrgPage} from '../connectrg/connectrg';
@Component({
selector: 'page-connectreg',
templateUrl: 'connectreg.html',
providers: [ObsAuthService]
})
export class ConnectregPage {
constructor(private nav: NavController, private auth: ObsAuthService,
private alertCtrl: AlertController, private loadingCtrl: LoadingController) {}
selectChange(e) {
console.log(e);
}
public rg(){
this.nav.push(ConnectrgPage);
}
}
尝试
<ion-select [(ngModel)]="category" (ionChange)="selectChange(category)">
<ion-option value="i">Individual</ion-option>
<ion-option value="t">3rd party</ion-option>
<ion-option value="d">Dedicated</ion-option>
</ion-select>
<div *ngIf="category==='t'">Show 3rd Party desc</div>
我有一个使用组合框选择类别的页面。当我单击组合框中的任何项目时,我需要在组合框下方获取所选项目的一些描述。
不知道怎么实现。
<ion-header>
<ion-navbar>
<ion-title>REGISTRATION</ion-title>
</ion-navbar>
</ion-header>
<ion-content>
<h1>Step 1 : Choose the category</h1>
<ion-item>
<ion-label>Category</ion-label>
<ion-select [(ngModel)]="category">
<ion-option value="i">Individual</ion-option>
<ion-option value="t">3rd party</ion-option>
<ion-option value="d">Dedicated</ion-option>
</ion-select>
</ion-item>
</ion-content>
<ion-footer no-shadow class="foot">
<ion-toolbar position="bottom">
<button (click)="rg()" ion-button full color="primary" block>Next</button>
</ion-toolbar>
</ion-footer>
import { Component } from '@angular/core';
import { NavController, AlertController, LoadingController, Loading, IonicPage } from 'ionic-angular';
import { ObsAuthService } from '../../services/obs_auth.services';
import { ConnectrgPage} from '../connectrg/connectrg';
@Component({
selector: 'page-connectreg',
templateUrl: 'connectreg.html',
providers: [ObsAuthService]
})
export class ConnectregPage {
constructor(private nav: NavController, private auth: ObsAuthService,
private alertCtrl: AlertController, private loadingCtrl: LoadingController) {}
selectChange(e) {
console.log(e);
}
public rg(){
this.nav.push(ConnectrgPage);
}
}
尝试
<ion-select [(ngModel)]="category" (ionChange)="selectChange(category)">
<ion-option value="i">Individual</ion-option>
<ion-option value="t">3rd party</ion-option>
<ion-option value="d">Dedicated</ion-option>
</ion-select>
<div *ngIf="category==='t'">Show 3rd Party desc</div>