import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams} from 'ionic-angular';
import { FormGroup, FormControl} from '@angular/forms';
import { ViewController} from 'ionic-angular';
import { ModalController } from 'ionic-angular';
import { TabsPage } from "../tabs/tabs"
@IonicPage()
@Component({
selector: 'page-dashboard',
templateUrl: 'listing.html'
})
export class ListingPage {
constructor(public navCtrl: NavController, public navParams: NavParams, public modalCtrl: ModalController) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad Dashboard');
}
//modals started
filterSort() {
let modal = this.modalCtrl.create(SortModal);
modal.present();
}
}
@Component({
selector:"sort-page",
templateUrl:"filter/sort.listing.filter.html",
providers:[ListingPage]
})
export class SortModal {
relationship:string;
filtersStore:Array<string>=[];
public myForm: FormGroup;
constructor(private _filterservice:FilterModalsService,private _v:ViewController,private _sharedservice: SharedService,private listingpage:ListingPage,public navCtrl: NavController){
this.myForm = new FormGroup({
langs: new FormControl()
})
}
doSubmit() {
this.listingpage.onSearch(0,true);
this._v.dismiss();
}
reset(){
this.myForm.reset();
this._sharedservice.deleteData();
}
}
listingpage
是父组件,我在其中打开SortModal
组件作为离子2中的模态,子项为SortModal
但是当我通过defualt打开模态时,每个元素都被重置然后我从列表中选择一个并关闭模态,但当我再次打开模态时,所有值再次为空。我希望保留值,我之前选择的无线电元素