我有一个页面,其中包含一个带有组合框的类别。 当我单击组合框中的任何项目时,我需要在组合框下方获取该选定项目的一些描述。
我不知道如何实现它。
<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>